Converting '\n' to "\n"
David Dick
david_dick at iprimus.com.au
Tue Jun 10 05:27:44 CDT 2003
Paul Fenwick wrote:
>G'day David,
>
>On Tue, Jun 10, 2003 at 07:59:50PM +1000, David Dick wrote:
>
>
>
>>Struck an interesting one today. Starting with
>>
>>my ($t) = '\n';
>>
>>how does one convert it to be equal to "\n", ie a normal line feed?
>>
>>
>
> $t =~ s/\\n/\n/g;
>
i thought i was crazy for a second there. Then i realised that i just
hadn't stated the problem fully. :)
for a more general solution,
$t =~ s/\\(.)/\$1/g; # was the best i could guess at
and doesn't work of course. I'm running an Expect app with stuff drawn
from a database, so "\r", "\n", "\whatever" is highly probable. :)
>
>Or am I missing something here?
>
>Cheers,
>
> Paul
>
>
>
More information about the Melbourne-pm
mailing list