Debugging Practice

Steve Lane sml at zfx.com
Mon Jun 14 12:06:42 CDT 1999


On the Jax.PM jacksonville-pm-list;
Steve Lane <sml at zfx.com> wrote -


Bill Jones wrote:
> Where is @{[]} used in the real world?  Well, inside 'HERE' Docs you cannot
> use a system call with either `` (backticks) or systems(), you have to
> basically do something like -
> 
> print << __HERE_Doc;
> Your Unix ENVIRONMENT:
> @{[ die if ((system("set")) > 0) ]};
> 
> (For an example, see http://jacksonville.pm.org/source/sysadmin)
> __HERE_Doc
> 
> Reference: Look up Perl FAQ 4 - Data Manipulation.

it's not just system calls that you can put in
the @{[]} bizarrity, it's any perl code.  i most
often (by far) use it because i have a long
here-doc that needs the result of a subroutine call,
like

  $mail = <<EOF;
  To: akljsdlkj\@aldks.com
  your toys were shipped on @{[ &shipping($id) ]}.  so there.
  EOF

the @{[]} hack is one of the ugliest of Perl idioms, IMO.
but i will use it if it makes surrounding code more
consise.
--
Steve Lane <sml at zfx.com>


The Jacksonville Perl Monger's Group is operated by -
Bill -Sneex- Jones ( sneex at usa.net ),
to whom send all praises, complaints, or comments...




More information about the Jacksonville-pm mailing list