From: "Uri Guttman"
> > "JK" == Jenda Krynicky writes:
>
> JK> From: "Joseph L. Casale"
> >> 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 wil
> "t" == trapd00r writes:
>> 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).
t> When I dont want to use a temp var, I us
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).
When I dont want to use a temp var, I usually do like this:
print << "EOF";
foo @{[scala
> "JK" == Jenda Krynicky writes:
JK> From: "Joseph L. Casale"
>> 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
From: "Joseph L. Casale"
> Inside a here doc, how can I force an expression to be evaluated
> such as localtime:
>
> print <<"END";
>
> `localtime time`
> Foo
> Bar
>
> END
use Interpolation eval => 'eval';
print <<"END";
$eval{localtime time}
Foo
Bar
END
CPAN - http://search.cpan.org
Jim Gibson wrote:
Joseph L. Casale:
Inside a here doc, how can I force an expression to be evaluated
such as localtime [...]
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 [...]
>> You can use the trick mentioned in 'perldoc -q string' "How do I expand
>> function calls in a string?"
Funny that the perldoc uses the exact function I wanted to use:)
>localtime is a Perl function, not an external command, so:
Thanks guys!
jlc
--
To unsubscribe, e-mail: beginners-unsubscr.
Jim Gibson wrote:
On 4/30/10 Fri Apr 30, 2010 9:27 AM, "Joseph L. Casale"
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;
Bu
On 4/30/10 Fri Apr 30, 2010 9:27 AM, "Joseph L. Casale"
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 tim