bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monasterians,
I couldn't get this map to work until I added the arrow operator, which I though was just for class methods and deferencing. Can someone explain what is going on with the arrow in this context, when nothing is being dereferenced AFAIK. Thanks.
my @pages = ( {'level' => '1','id' => 4}, {'level' => '2','id' => 10} ); my @ids = map { $_->{'id'} } @pages; print Dumper (@id); __END__ $VAR1 = 4; $VAR2 = 10;
—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Not understanding the arrow operator
by kennethk (Abbot) on May 18, 2009 at 20:02 UTC | |
by bradcathey (Prior) on May 18, 2009 at 20:23 UTC | |
Re: Not understanding the arrow operator
by DStaal (Chaplain) on May 18, 2009 at 20:05 UTC | |
Re: Not understanding the arrow operator
by morgon (Priest) on May 18, 2009 at 20:27 UTC | |
by JavaFan (Canon) on May 18, 2009 at 21:04 UTC | |
by morgon (Priest) on May 18, 2009 at 21:20 UTC | |
Re: Not understanding the arrow operator
by John M. Dlugosz (Monsignor) on May 18, 2009 at 19:59 UTC |
Back to
Seekers of Perl Wisdom