Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Array mysteriously growing

by duff (Parson)
on Mar 09, 2006 at 15:59 UTC ( #535416=note: print w/replies, xml ) Need Help??


in reply to Array mysteriously growing

This also doesn't answer your question, but rather than checking if there's a "next element" in your array, check that your index hasn't gone beyond the end of your array:

$next_version_key = $ordered_list->[$i+1]->[0] if $i+1 < @{$ordered_li +st};

Replies are listed 'Best First'.
Re^2: Array mysteriously growing
by pKai (Priest) on Mar 09, 2006 at 22:21 UTC

    Depending what appears more natural to you, you can also check this as

    if $i < $#$ordered_list;

      Aye. I prefer the way I did it because it uses $i+1 in both places.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://535416]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2020-06-01 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (177 votes). Check out past polls.

    Notices?