Converting '\n' to "\n"

Rick Measham rickm at isite.net.au
Tue Jun 10 05:24:13 CDT 2003


At 7:59 PM +1000 10/6/03, David Dick wrote:
>G'day all,
>Struck an interesting one today.  Starting with
>
>my ($t) = '\n';

Firstly, it should be either:
my $t = '\n'; # or possibly
my ($t) = ('\n'); # but only if there's a good reason (I can't think of one)

The parens () say 'this is a list' so in your example you're 
assigning a single value to a list.

>how does one convert it to be equal to "\n", ie a normal line feed?

$t=~s/\\n/\n/g;

Will do the trick .. is that what you need or have I completely 
missed the point?

-- 
--------------------------------------------------------
             There are 10 kinds of people:
   those that understand binary, and those that don't.
--------------------------------------------------------
   The day Microsoft makes something that doesn't suck
     is the day they start selling vacuum cleaners
--------------------------------------------------------
"Write a wise proverb and your name will live forever."
    -- Anonymous
--------------------------------------------------------



More information about the Melbourne-pm mailing list