On Sun, Jun 01, 2003 at 08:36:34PM -0400 Todd Wade wrote:
> "Tassilo Von Parseval" <[EMAIL PROTECTED]> wrote in
> message news:[EMAIL PROTECTED]
> > On Sun, Jun 01, 2003 at 11:22:32AM +0200 Kevin Pfeiffer wrote:
> >
> <snip />
> >
> > open DATA, ">@{[ CFG ]}" or die ...;
> >
> > The part between @{[ ]} is arbitry Perl-code that is executed in list
> > context and the last expression evaluated in this Perl code is what gets
> > eventually printed.
> >
>
> If you want to interpolate a scalar value in a string you should probably
> avoid creating an array reference, if only to avoid confusion:
>
> [EMAIL PROTECTED] trwww]$ perl
> use constant A_CONSTANT => '/some/path';
> print("the constant's value is: ${ \A_CONSTANT }\n");
> Ctrl-D
> the constant's value is: /some/path
That's a bit better here because ${ \... } will execute the code in
scalar-context instead of list-context. However, it wont always work as
expected which is why I seldom use it. For instance:
# this should work _theoretically_
print "${ \localtime }";
# but doesn't:
__END__
1
Instead one needs to explizitely enforce scalar context. I think this is
a little non-intuitive:
print "${ \scalar localtime }";
__END__
Mon Jun 2 07:50:54 2003
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]