SPUG: Re: for-here; sub interpolation
ced at carios2.ca.boeing.com
ced at carios2.ca.boeing.com
Wed Sep 20 19:33:30 CDT 2000
On Tue, Sep 19, 2000 at 05:06:48PM -0700, El JoPe Magnifico wrote:
>
> The alternative, which they're still propping up in the third edition
> of the camel book, is cumbersome, inefficient, and still requires you
> to keep your delimiter flush to the left:
>
> ($quote = <<DELIMITER) =~ s/^\s+//gm;
> this text will not be indented
> when you use it later
> DELIMITER
You can avoid "flushing the delimiter" but you'll need a
strong stomach:
($quote = <<" DELIMITER") =~ s/^\s+//gm;
this text will not be indented
when you use it later
DELIMITER
>> ...
>> Func;
>> Func();
>> &Func;
>> &Func();
>> Perhaps it's just too hard to look at the string "this is some text ('not
>> really')" and figure out whether or not to call text('not really') or to
>> just leave it alone?
>> 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.
rgds,
--
Charles DeRykus
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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