In article
, Brandon
McCaig wrote:
> On Tue, Oct 19, 2010 at 2:31 AM, brian d foy wrote:
> > Actually, we call it the "range operator" in Learning Perl. It just
> > happens to be in a more general section named "List Literals". Both
> > "range operator" and '..' have entries in the indices of Le
On Tue, Oct 19, 2010 at 2:31 AM, brian d foy wrote:
> Actually, we call it the "range operator" in Learning Perl. It just
> happens to be in a more general section named "List Literals". Both
> "range operator" and '..' have entries in the indices of Learning Perl
> and Programming Perl. Perhaps y
In article <20101018005850.ga2...@playground.mcclains.net>, Mike
McClain wrote:
> This threw me for a loop for a while since there is no comma in
> map { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ]->[1] } keys %HoAoA;
> but I figured out that the range operator '
?
> > > > my @arrays =
> > > > map
> > > > { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ] }
> > > > keys %HoAoA ;
> >
> > > > my @seconds =
> > > > map { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ]-&
/ ] ],
> >> );
> >>
> >> # this gets refs to all arrays
> >> my @arrays =
> >> map
> >> { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ] }
> >> keys %HoAoA ;
> >
> >This is equivalent to:
&g
ments?
> > > my @arrays =
> > > map
> > > { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ] }
> > > keys %HoAoA ;
>
> > This is equivalent to:
> > map { @{$HoAoA{$_} } } keys(%HoAoA);
>
> > Which flattens all the arrays into one b
# 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..$#{ $HoAo
On Wed, Oct 13, 2010 at 08:33:57AM +0200, Shlomi Fish wrote:
> On Wednesday 13 October 2010 06:39:03 Mike McClain wrote:
> > Why do @arrays and @seconds not have the same number of elements?
> > my @arrays =
> > map
> > { @{ $
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
ar
c1 bc2 / ]
> ],
>
> );
>
> # this gets refs to all arrays
> my @arrays =
>
> map
> { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ] }
> keys %HoAoA ;
>
This is equivalent to:
{{{
map { @{$HoAoA{$_} } } keys(
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 only gets the second entry from the last array of each hash entry
my
a1 ba2 / ], [ qw / bb1 bb2 / ], [ qw / bc1 bc2 / ] ],
);
# this gets refs to all arrays
my @arrays = map { @{ $HoAoA{$_} } [ 0..$#{ $HoAoA{$_} } ] } keys %HoAoA ;
# this only gets the second entry from the last array of each hash entry
my @seconds = map { @{ $HoAoA{$_} } [
12 matches
Mail list logo