in reply to match last element instead of first??
use strict; use warnings; my $restOfLine = q{one fish two fish red fish blue fish}; my @words = $restOfLine =~ m{(\S+)\s+fish}g; print qq{$_\n} for @words;
which produces
one two red blue
I hope this is of use.
Cheers,
JohnGG
|
|---|