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

Re: Check last character of a string

by pjotrik (Friar)
on Aug 06, 2008 at 11:12 UTC ( [id://702600]=note: print w/replies, xml ) Need Help??


in reply to Check last character of a string

How about testing and adding in one step?
$x =~ s/([^\\])$/$1\\/

Replies are listed 'Best First'.
Re^2: Check last character of a string
by Anonymous Monk on Aug 06, 2008 at 15:46 UTC
    Or without a capture:

    perl -wMstrict -le "for (@ARGV) { print; s{ (?<! \\) $ }'\\'xms; print } " with\ sans with\ with\ sans sans\

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-20 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found