[Pdx-pm] subroutine calls CAN be string-interpolated!
Eric Wilhelm
scratchcomputing at gmail.com
Sat Dec 10 11:56:53 PST 2005
And you thought they had to be concatenated with that messy
quote-breaking " . thing($stuff) . " syntax.
perl -e 'use constant foo => 7, 6; print "foo: @{[foo]}\n";'
Is this undocumented or just obscure?
http://use.perl.org/~Eric%20Wilhelm/journal/27926
And even:
perl -e '@f = (1,2,3);
sub a {my @thing = @_; return(scalar(@thing));};
print qq(foo: @{[a(@f)]}\n);'
Wow! And I thought Ruby's "#{code goes here}" interpolation was
something I couldn't do in Perl!
--Eric
--
If the collapse of the Berlin Wall had taught us anything, it was that
socialism alone was not a sustainable economic model.
--Robert Young
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
More information about the Pdx-pm-list
mailing list