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

The Perl question of the here document

Thread Next
From:
Majian
Date:
October 21, 2009 04:04
Subject:
The Perl question of the here document
Message ID:
eb686fc70910210404n1066bc0by6146c498197ee485@mail.gmail.com
Dear list:

  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

                    I also write it like this :
                         #!/usr/bin/perl
                           $now =`date`;
                            print <<END;
                              Today is $now
                             END

                     This script will be displayed t this "Today is   Wed
Oct 18:38 CST 2009"


                    Is it an  error of the book ?Or Can the Perl would
execute the Shell command in  here document with the  signal quotes?

                      Thanks in advance ~~~~

Thread Next


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