develooper Front page | perl.beginners | Postings from October 2009

Re: The Perl question of the here document

Thread Previous
From:
John W. Krahn
Date:
October 21, 2009 04:49
Subject:
Re: The Perl question of the here document
Message ID:
4ADEF538.6010304@shaw.ca
Majian wrote:
> Dear list:

Hello,

>   Sorry to distrub all .
> 
>             When I learned  Perl on the book called "Perl by example 4th
> Chinese Edition ", I found there was an  error on this book .
> 
>            There had  a perl script  writted by this :
>               #!/usr/bin/perl
>                   print << 'END';
>                      echo Today is
>                       date
>                    END
> 
>                The book said the  script would display this :
>                                 Today is
>                                   Fir Oct 27 12:48:36 PDT 2007
> 
>                  But when I put it on my OS called CentOS 5.3  and run it
> ,the output  like this :
>                               echo Today is
>                                date

Instead of:

                    print << 'END';

That should be:

                    print << `END`;

For example:

$ perl -le'
print << `END`;
    echo Today is
     date
END
'
Today is
Wed Oct 21 04:46:53 PDT 2009




John
-- 
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About