punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
Uh, it's Twilight Zone time here. For three years this has been working fine:
Then a few days ago the loop stopped working. After addingforeach $group_id (keys %data) { @temp = sort keys %{ $data{$group_id} }; $my_hoa{$group_id}{'ordered'} = [ @temp ]; } foreach $group_id (sort keys %my_hoa) { for $i (0 .. $#{ @{ $my_hoa{$group_id}{'ordered'} } }) { # output some stuff; } }
at the beginning of the output loop, it became clear thatprint "<p>array length = ".$#{ @{ $pubs{$lang_group_id}{'pub_alpha_ord +er'} } }."<p>\n";
$#{ @{ $pubs{$lang_group_id}{'pub_alpha_order'} } }
was coming back as -1.
Weird, but ok, so just for argument's sake I changed it to
$#{ $pubs{$lang_group_id}{'pub_alpha_order'} }
And miracle of miracles, we're back in business. But, cue the Twilight Zone music, as I said, this has been working fine for years. Or has it?
Two possibilities - it never really worked, everyone just thinks they remember it working, or the server admins updated Perl and the new version refers to this kind of thing differently? So I'm inquiring about the second possiblity - did the way you refer to this change in a recent update of Perl? If not, we're checking the koolaid.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Something changed in how to refer to length of hash of arrays?
by ikegami (Patriarch) on May 06, 2009 at 17:20 UTC | |
|
Re: Something changed in how to refer to length of hash of arrays?
by JavaFan (Canon) on May 06, 2009 at 18:02 UTC | |
|
Re: Something changed in how to refer to length of hash of arrays?
by GrandFather (Saint) on May 07, 2009 at 03:16 UTC |