Uri Guttman wrote:
"SHC" == Shawn H Corey <shawnhco...@gmail.com> writes:

  SHC> Uri Guttman wrote:
>> >> print <<TEXT ;
  >> All STDOUT/STDERR will be assigned to this scripts audittrail log!!
  >> All STDOUT/STDERR will be assigned to this scripts audittrail log!!
  >> All STDOUT/STDERR will be assigned to this scripts audittrail log!!
  >> TEXT

  SHC> Or
  SHC> print "All STDOUT/STDERR will be assigned to this scripts audittrail
  SHC> log!!\n" x 3;

i would assume he wasn't really printing the same line 3 times. and he
was using printf all over his code which is bad. the here docs is just a
good way to make multiline printing better.

and for other newbies here, note that here docs are NOT a feature of
print, but another quoting mechanism. i have seen too many newbies think
here docs are only used with print since it is a common idiom. you can
use here docs for any long string anywhere you can put a quoted string
in perl.

uri


OK, since you asked :)

{
    my $text = <<END_OF_TEXT x 3;
All STDOUT/STDERR will be assigned to this scripts audittrail log!!
END_OF_TEXT
    print $text;
}


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

Regardless of how small the crowd is, there is always one in
it who has to find out the hard way that the laws of physics
applies to them too.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to