On 4/30/10 Fri Apr 30, 2010 9:27 AM, "Joseph L. Casale"
<[email protected]> scribbled:
> Inside a here doc, how can I force an expression to be evaluated
> such as localtime:
>
> print <<"END";
>
> `localtime time`
> Foo
> Bar
>
> END
>
>
> I know I can simply create the var before,
> my $var = localtime time;
>
> But just curious how to evaluate expressions inside this...
You can use the trick mentioned in 'perldoc -q string' "How do I expand
function calls in a string?", referencing, then dereferencing an array, but
it is ugly:
print <<"END";
@{ [`localtime time`] }
Foo
Bar
END
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/