$ perl -le' my $list = "This is my list"; $list =~ /(.+)\s(\w+)/; my $last = $2; my $the_rest = $1; print $the_rest; print $last; ' This is my list
$ perl -le' my $list = "This is my list"; ( reverse $list ) =~ /(\w+)\s(.+)/; my $last = reverse $1; my $the_rest = reverse $2; print $the_rest; print $last; ' This is my list
In reply to Re: Match last word in a sentence
by jwkrahn
in thread Match last word in a sentence
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |