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?
Thanks,
Mike


Reformatting due to my mailer's limitations:

#!/usr/bin/perl

use strict;
use warnings;

{

     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.



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to