Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Match last word in a sentence

by tybalt89 (Monsignor)
on Aug 14, 2021 at 02:41 UTC ( [id://11135837]=note: print w/replies, xml ) Need Help??


in reply to Match last word in a sentence

#!/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")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135837]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found