How can I manually interpolate string escapes in a Perl string?

Posted by Ryan Thompson on Stack Overflow See other posts from Stack Overflow or by Ryan Thompson
Published on 2010-04-17T21:21:55Z Indexed on 2010/04/17 21:33 UTC
Read the original article Hit count: 234

In perl suppose I have a string like 'hello\tworld\n', and what I want is:

'hello  world
'

That is, "hello", then a literal tab character, then "world", then a literal newline. Or equivalently, "hello\tworld\n" (note the double quotes).

In other words, is there a function for taking a string with escape sequences and returning an equivalent string with all the escape sequences interpolated?

© Stack Overflow or respective owner

Related posts about perl

Related posts about string-interpolation