On Tue, Oct 12, 2010 at 11:25:18PM -0700, John W. Krahn wrote: > Mike McClain wrote: > > I've looked at this for a few days but still can't see 'why' > >I get what I do. > >Why do @arrays and @seconds not have the same number of elements? <snip> > > # this only gets the second entry from the last array of each hash > > entry > > my @seconds = map { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ]->[1] } > > keys %HoAoA ; > > @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ] is an array slice and > OBJECT->[1] dereferences OBJECT as if it were an array and accesses the > second element _however_ an array slice is not an array reference so > this won't work. Why it returns the last element of the last array is > beyond me. :-(
Thanks John that helps explain why I don't get what I expected. Mike -- Satisfied user of Linux since 1997. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/