[lug] Perl question: how to print embedded metacharacters

Jeffrey Haemer jeffrey.haemer at gmail.com
Wed Nov 25 08:56:57 MST 2009


Chip,

Can you do this instead?

my $kw = "abc\ndef";

If not, can you explain in enough detail that I can try again? :-)

On Wed, Nov 25, 2009 at 8:29 AM, Chip Atkinson <chip at pupman.com> wrote:

> 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
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#hackingsociety
>



-- 
Click to Call Me Now! --
http://seejeffrun.blogspot.com/2009/09/call-me-now.html

Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell],  @goyishekop [twitter]
http://www.youtube.com/user/goyishekop [vlog]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20091125/d5e1f67e/attachment.html>


More information about the LUG mailing list