in reply to Re: Concise foreach expression
in thread Concise foreach expression
which means you won't have much use of nested loops with map
Could you explain what you mean there? map localizes $_, so nested maps are not a problem. Code like the following (admittedly contrived) snippet works as expected ($_ is not clobbered by the inner map):
my @list = ( ["Barney", "Rubble"], ["Fred", "Flintstone"], ["Betty", "Rubble"], ["Wilma", "Flintstone"] ); map { say "Outer map before: @$_"; map { 1 } @$_; say "Outer map after : @$_"; } @list;
But perhaps there's other pitfalls, so I'd be grateful for any enlightenment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Concise foreach expression
by choroba (Cardinal) on Aug 29, 2014 at 17:14 UTC | |
|
Re^3: Concise foreach expression
by LanX (Saint) on Aug 29, 2014 at 17:00 UTC | |
by AppleFritter (Vicar) on Aug 29, 2014 at 17:21 UTC | |
by LanX (Saint) on Aug 29, 2014 at 17:42 UTC |