>>>>> "JK" == Jenda Krynicky <je...@krynicky.cz> writes:

  JK> From: "Joseph L. Casale" <jcas...@activenetwerx.com>
  >> Inside a here doc, how can I force an expression to be evaluated
  >> such as localtime:

here docs are just a different form of string so any technique which
works in quoted strings will work in here docs. basic here docs are
double quoted so they will interpolate scalars and arrays.

  JK> use Interpolation eval => 'eval';

  JK> print <<"END";

  JK>  $eval{localtime time}
  JK>  Foo
  JK> Bar 

  JK> END

i would say to just use a temporary scalar variable. there is no shame
in doing this and it is simpler than using the Interpolation module
which is doing tied things and calling eval (which is dangerous).

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
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