SPUG: Re: for-here; sub interpolation
Colin Meyer
cmeyer at helvella.org
Wed Sep 20 20:37:09 CDT 2000
On Wed, Sep 20, 2000 at 05:33:30PM -0700, ced at carios2.ca.boeing.com wrote:
>
> >> I think it would be cleaner if you only could interpolate basic arrays
> >> and scalars inside of double-quoted strings. I can never remember if
> >> "$arr->[0]->[0]" is going to work or not, so I use printf or sprintf for
> >> anything worse than $scalar or @array.
>
> I think there's no ambiguity if $arr is an array reference
> so "$arr->[0]->[0]" is a simple lookup and does work. But,
> function/method calls must throw a monkey wrench in the
> parsing as you suggest.
Unless you use one of MJD's wierd and scary modules.
>From perldoc Interpolation:
SYNOPSIS
use Interpolation name => \&function, ...;
print "la la la la $name{blah blah blah}";
# This is like doing:
$VAR = &function(blah blah blah);
print "la la la la $VAR";
-C.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list