in reply to Line break interpretation

fpondemer, Welcome to the Monastery! Make yourself at home.

change

my $Message = 'Hello\nWorld';

into

my $Message = "Hello\nWorld";

and check now. Only double quotes ll interpolate not single quote which you have given as input. Also take a look at perldata

update: Oops! sorry, misunderstood the question. davorg++ thanks.

Prasad

Replies are listed 'Best First'.
Re^2: Line break interpretation
by davorg (Chancellor) on Oct 19, 2006 at 15:28 UTC

    You're misunderstanding the question. The string is being read from a file. Try working with this:

    #!/usr/bin/perl use strict; use warnings; my $message = <DATA>; # ... some code goes here print $message; __END__ Hello\nWorld

    Putting the string in single quotes simulates the action of reading the data from a file.

    --
    <http://dave.org.uk>

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