[lug] Perl question: how to print embedded metacharacters

Chip Atkinson chip at pupman.com
Wed Nov 25 08:29:03 MST 2009


Greetings,

I'm working on a perl script that reads strings from a configuration file
and prints them out.  What I'd like to be able to do is have any embedded
metacharacters interpreted but I'd like to avoid doing the substitutions
myself.  

For example, here is a little script to emulate the problem:

#!/usr/bin/perl

my $kw = 'abc\ndef';

print "$kw";
----------------------
the output is 
abc\ndef

What I want is 
abc
def

--------------
I tried to jfgi but no joy. 

Thanks in advance.

Chip




More information about the LUG mailing list