rsFalse has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; @_ = 'a' .. 'c'; print @_[ map $_ -1, grep { $_ > 0 and $_ <= 1 } map { $_ + 1 } -1 .. 1 ];
And the following (with map block) don't give an error:Missing comma after first argument to map function at map_inside_splic +e.pl line 12, near "]"
OUTPUT:use warnings; use strict; @_ = 'a' .. 'c'; print @_[ map {$_ -1} grep { $_ > 0 and $_ <= 1 } map { $_ + 1 } -1 .. 1 ];
upd: thanks for answers below.a
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: map sentence as array slice indexes
by BrowserUk (Patriarch) on Nov 25, 2015 at 12:08 UTC | |
|
Re: [closed] map sentence as array slice indexes
by Discipulus (Canon) on Nov 25, 2015 at 12:09 UTC |