Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: sed command in perl

by AnomalousMonk (Archbishop)
on Jun 08, 2016 at 23:03 UTC ( [id://1165189]=note: print w/replies, xml ) Need Help??


in reply to Re^2: sed command in perl
in thread sed command in perl

If you have Perl version 5.10 or later, this also works:

c:\@Work\Perl\monks>perl -wMstrict -le "use 5.010; ;; for my $s ('21112,/vol/voly,blx', '21113,/vol/eng,blz', '21114,/vol +/eng,file') { my $t = $s; $t =~ s{ .* \K , }{}xms; print qq{'$s' -> '$t'}; } " '21112,/vol/voly,blx' -> '21112,/vol/volyblx' '21113,/vol/eng,blz' -> '21113,/vol/engblz' '21114,/vol/eng,file' -> '21114,/vol/engfile'

Update: Slightly changed code example to enhance clarity.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found