This is Part One of a Multipart posting - just to see if we can't keep things in the list archieves (Give the listbots something to do :)

(These are not really posted questions so much as they are things that beginners need to consider.)


"HERE" DOCUMENTS


* Here documents are used to embed lines of text in a Perl
  script, for printing or variable assignment.

  $foo = <<EOT
  testing
  one
  two
  three
  $four
  EOT

print <<_Html_;
various basic html can go here

sprinkled with Perl variables...
_Html_

NOTE that the ending portion of a heredoc must be in column zero -- I have noticed that having indented can cause issues at times...


* Variable interpolation is "on" by default. You turn it off by making it single quoted.

  print <<'EOP0'
  interpolation is off:
  $foo $bar are not converted to data
  EOP0

Whether you use Double quotes, the variables are
interpolated into their corrisponding data:

  print <<EOP1
  interpolation supported:
  $foo is related to $bar
  EOP1


# The following is somewhat dangerous; use with # appropriate caution -

* Commands will be executed if the ending-string uses backticks.
  $sommand_results = <<`END_OF_COMMANDS`
  ls -al
  ps -aux
  END_OF_COMMANDS

Also, I previously posted how to cram single lines of text into an array; it is left upto the reader as an exercise to find that posting out there in Usenet land.


That's a small start to what I hope will become a long term thing :)


So, if you have a statement or neat easy to understand fact about HERE Documents, post it; keep this Perl Chain Posting going...

-Bill-
__Sx__________________________________________
http://youve-reached-the.endoftheinternet.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to