From: Uri Guttman u...@stemsystems.com
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
From: Joseph L. Casale jcas...@activenetwerx.com
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 -
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
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
t == trapd00r trapd...@trapd00r.se 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
[...]
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{,}; #
SQL;
SELECT
id
, name
FROM
things
WHERE
id IN (@id
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,
On 4/30/10 Fri Apr 30, 2010 9:27 AM, Joseph L. Casale
jcas...@activenetwerx.com 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 =
Jim Gibson wrote:
On 4/30/10 Fri Apr 30, 2010 9:27 AM, Joseph L. Casale
jcas...@activenetwerx.com 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 =
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:
10 matches
Mail list logo