in reply to Perl's Bad Ideas

Just a thought but about the only time I use that is when looping over the indexes of an array. Since perl6 (iirc) will have a way to do forech @list while still keeping the position in the array I imagine that the need for this will become even rarer still.

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Replies are listed 'Best First'.
Re: Re: Perl's Bad Ideas
by no_slogan (Deacon) on Apr 05, 2002 at 18:48 UTC
    Check the latest Exegesis. Looks like $#array is going away, to be replaced with @array.last
    ...perl6 (irrc) will have a way to do forech @list while still keeping the position in the array...
    It seems that the plan is to enhance foreach so it can go through a list two elements at a time, then use the @list.kv method to get a list of alternating indexes and values.
      Is it just me, or does it not seem like @array.last should return the last element of the array, rather than the index of the last element?
        And there I was thinking that TheDamian suggesting it would probably be @array.end over @array.last because of the saved char...

        But more (or less :-) seriously, if @array.last did return the last element (i guess it would be an alias for  @array[-1]) would there also be an @array.first?

        Yves / DeMerphq
        ---
        Writing a good benchmark isnt as easy as it might look.