in reply to Line break interpretation

String eval does the trick.

my $m = 'Hello\nWorld'; print eval "qq($m)";
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^2: Line break interpretation
by fpondemer (Initiate) on Oct 19, 2006 at 17:54 UTC
    That solved my issue, thanks a lot.

      Be careful! If the input is untrusted, that snippet could execute arbitrary code. (Consider my $m = '); arbitrary perl command here';) Be sure to place big red arrows in your comments.

      String::Interpolate might be safer.

Re^2: Line break interpretation
by blazar (Canon) on Oct 21, 2006 at 15:33 UTC
    String eval does the trick.

    In addition to the other solutions that avoid string eval and its inherent risks, there's YAML::Syck::Load although that's probably an overkill:

    print Load '--- "Hello\nWorld\n"';