in reply to Re: Improve foreach with help of map?
in thread Improve foreach with help of map?
Hey that solved it, thx! Knew there was a shorter way of saying that :)
The final code is as...
my ($dummy, $dummy, $result) = map /(\d\d \w\w\w \d\d\d\d)/, split /\n +/, $content;
Instead of.
my $match = 0; my $result = undef; foreach(split /\n/, $content) { if(/End Date/) { $match = 1 } elsif($match && /(\d\d \w\w\w \d\d\d\d)/) { $result = $1; last; } }
Thx again!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Improve foreach with help of map?
by ikegami (Patriarch) on Oct 09, 2009 at 15:18 UTC | |
by mickep76 (Beadle) on Oct 09, 2009 at 15:27 UTC |