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
> "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 quot
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
rray, but
it is ugly [...]
What makes you say it "is" ugly?
To me it is just another useful language feature.
But it needs plenty of space. :)
I use $" in here-docs as well:
perl -wle'
my @id = 1..5;
my $sql = do {
local $" = q{,}; #"
<
>> 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
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...
Thanks!
jlc
--
To unsubscribe, e-
10 matches
Mail list logo