- or download this
use strict;
use warnings;
...
my $the_rest = $1;
print "the_rest='$the_rest'\n";
print "last='$last'\n";
- or download this
the_rest='This is my lis'
last='t'
- or download this
$list =~ /
^(.+) # The 'rest' (Everything before last word)
\b(\w+) # Last 'word' (string of contiguous word characters)
\W*$ # Possible non-word characters at end of string
/x;