[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] awww, no fun :(



On Thu, Apr 12, 2001 at 01:53:51PM -0400, Jeff Pinyan wrote:
> On Apr 12, Michael G Schwern said:
> 
> >On Thu, Apr 12, 2001 at 01:20:35PM -0400, Jeff Pinyan wrote:
> >> I get told that I can't call last().  That's upsetting.  Does anyone know
> >> how to emulate the effect, other than change $foo++ to
> >> 
> >>   tied($foo)->STORE($foo + 1);
> >> 
> >> (which works, by the way).
> >
> >I'm more than a little distrubed by this.  Consider...
> >
> >  perl -wle 'sub foo { last; } while(1) { foo() }'
> >
> >In any sane universe, that loop would never exit.  In perl's, it exits
> >on the first iteration (with a warning).  
> 
> Except that this functionality was explicitly added to Perl, around 5.005
> I believe.

% perl -wle 'sub foo { last; } while(1) { foo() }'
Exiting subroutine via last at -e line 1.

% perl -v

This is perl, version 5.004

...


(Note; that's the original 5.004, not a later maintenance version.)


I very much doubt this "functionality" was ever intended as a feature.


Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe