develooper Front page | perl.perl5.porters | Postings from July 2005

[perl #1500] Re: The extent of double-quotish interpolation

From:
Michael G Schwern via RT
Date:
July 12, 2005 19:07
Subject:
[perl #1500] Re: The extent of double-quotish interpolation
Message ID:
rt-3.0.11-1500-117097.18.894926251966@perl.org
> [RT_System - Mon Sep 20 02:46:44 1999]:
> 
> >Ah, I think I see what you mean now.  You want these to behave
differently:
> >
> >  DB<1> print $count = @array = ((undef) x 3)[0,1,2]
> >0
> >  DB<2> print $count = @array = ()[0,1,2]           
> >0
> >
> >You'd have the first version start returning three, but leave the second
> >version alone.  The potential for breakage here is certainly reduced
> >compared to what I misunderstood the original request to be, since there
> >are fewer cases that would change.  And it's quite possible that it's
> >the latter case that people rely upon more than it is the former one.
> >Whether it's exclusively the latter case that matters, I wonder.  But you
> >can't know what color the yolk is until you break the egg.
> 
> Omlette makers can sometimes tell without breaking anything. :-)

And they do behave differently.

0 ~/tmp$ perl -le 'print $count = @array = ((undef) x 3)[0,1,2]'
3
0 ~/tmp$ perl -le 'print $count = @array = ()[0,1,2]'
0

So I guess whatever this was about its been resolved.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About