#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11135816 use warnings; my $list = "This is my list"; $list =~ /(\w+)\W*\z/; use Data::Dump 'dd'; dd $`, $1;
Outputs:
("This is my ", "list")
In reply to Re: Match last word in a sentence
by tybalt89
in thread Match last word in a sentence
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |