in reply to map sub to list?
chr defaults to using $_, so use: @a = map f( $_ ), @numbers;.
Or define f() to default to $_:
sub f(_){ $_[0]+1 };
Now my @a = map f, @numbers; works.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: map sub to list?
by pldanutz (Acolyte) on Sep 09, 2013 at 17:15 UTC | |
by toolic (Bishop) on Sep 09, 2013 at 17:25 UTC | |
by pldanutz (Acolyte) on Sep 09, 2013 at 18:12 UTC | |
by pldanutz (Acolyte) on Sep 09, 2013 at 17:28 UTC | |
by Corion (Patriarch) on Sep 09, 2013 at 17:39 UTC | |
by LanX (Saint) on Sep 09, 2013 at 17:44 UTC | |
by toolic (Bishop) on Sep 09, 2013 at 17:34 UTC |