Converting '\n' to "\n"

Joshua Goodall joshua at roughtrade.net
Tue Jun 10 05:31:25 CDT 2003


On Tue, Jun 10, 2003 at 08:18:54PM +1000, 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;
> 
> Or am I missing something here?

More generally, if you want to use a string literal interpolation that
would normally be performed at compile-time, perhaps

$foo = eval qq("$t");

Koshua.

-- 
Joshua Goodall                                      "tea makes itself"
joshua at roughtrade.net                                       - Ana Susanj



More information about the Melbourne-pm mailing list