in reply to Get the last occurence of a pattern
my $last= $string =~ /.*(PATTERN)/s;
but
my $last= ( $string =~ /(PATTERN)/g )[-1];
or (first technique fixed in two different ways)
my $last= $string =~ /.*(PATTERN)/s ? $1 : undef; # or my( $last )= $string =~ /.*(PATTERN)/sg;
- tye
|
|---|