On Tue, Oct 12, 2010 at 11:48:03PM -0700, John W. Krahn wrote:
> Shlomi Fish wrote:
> >
> >On Wednesday 13 October 2010 06:39:03 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>
> >>     my %HoAoA =
> >>     (   a =>  [ [ qw / aa1 aa2 / ], [ qw / ab1 ab2 / ] ],
> >>         b =>  [ [ qw / ba1 ba2 / ], [ qw / bb1 bb2 / ],
> >>               [ qw / bc1 bc2 / ] ],
> >>     );
> >>
> >>     #   this gets refs to all arrays
> >>     my @arrays =
> >>         map
> >>         { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ] }
> >>         keys %HoAoA ;
> >
> >This is equivalent to:
> >{{{
> >map { @{$HoAoA{$_} } } keys(%HoAoA);
> >}}}
> >Which flattens all the arrays into one big list.
> 
> No, it just returns all the elements of the values of %HoAoA which are 
> array references.

I'm not clear on what you're saying here John.

If I add something to the array that is not an array like so:
    $HoAoA{"d"} = 'mud';

I get this error:
Can't use string ("mud") as an ARRAY ref while "strict refs" in use
and the program dies.

Further elucidation?
Mike
-- 
Satisfied user of Linux since 1997.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to