in reply to Is there a more functional regex syntax?
How's about:
use List::Util qw[ sum ]; my @ranges = ('15', '28-31', '3-4', '40', '17-19'); my $tMin = sum map{ /^(\d+)/ } @ranges; my $tMax = sum map{ /(\d+)$/ } @ranges; print "$tMin : $tMax";; 103 : 109
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is there a more functional regex syntax?
by smls (Friar) on Sep 18, 2012 at 17:36 UTC | |
by BrowserUk (Patriarch) on Sep 18, 2012 at 18:09 UTC | |
by tobyink (Canon) on Sep 18, 2012 at 19:18 UTC | |
by BrowserUk (Patriarch) on Sep 18, 2012 at 20:20 UTC |