in reply to Get the last occurence of a pattern

Update: Not:
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