in reply to Array Filter and Lookahead
If you really want the last integer in a string, you can find that as /.*(?<!\d)(\d+)/, and get the numbers as
my @filtered = map { /.*(?<!\d)(\d+)/; $1 // '' } @lines;
However you seem to want to turn 3.0 into 3 (and not 0), and I don't know the rules behind that. Do you want to permit decimals, and cut off zero-decimals behind the dot? Or something else?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array Filter and Lookahead
by AnomalousMonk (Archbishop) on Nov 20, 2012 at 20:00 UTC | |
by moritz (Cardinal) on Nov 21, 2012 at 06:38 UTC | |
|
Re^2: Array Filter and Lookahead
by daugh016 (Initiate) on Nov 20, 2012 at 21:00 UTC | |
by AnomalousMonk (Archbishop) on Nov 20, 2012 at 21:27 UTC |