Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Match last word in a sentence

by jwkrahn (Abbot)
on Aug 13, 2021 at 17:13 UTC ( [id://11135828]=note: print w/replies, xml ) Need Help??


in reply to Match last word in a sentence

$ 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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-16 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found