in reply to using map
One could use map as in
my @digits = map { $_ =~ m{ \d }xmsg } $list;
but it would be, IMHO, simpler, clearer and more idiomatic as
>perl -wMstrict -le "my $list = '1, 23-456 7890'; my @digits = $list =~ m{ \d }xmsg; printf qq{'$_' } for @digits; " '1' '2' '3' '4' '5' '6' '7' '8' '9' '0'
(Although, to echo JavaFan, it's not really clear just what you want.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using map
by jwkrahn (Abbot) on May 06, 2012 at 03:50 UTC | |
by BrowserUk (Patriarch) on May 06, 2012 at 05:56 UTC | |
by tobyink (Canon) on May 06, 2012 at 06:37 UTC | |
by jwkrahn (Abbot) on May 06, 2012 at 07:21 UTC | |
by tobyink (Canon) on May 06, 2012 at 07:24 UTC | |
by BrowserUk (Patriarch) on May 06, 2012 at 07:32 UTC | |
by Anonymous Monk on May 06, 2012 at 08:17 UTC | |
by BrowserUk (Patriarch) on May 06, 2012 at 08:45 UTC | |
by AnomalousMonk (Archbishop) on May 06, 2012 at 05:23 UTC |