Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Regex capturing

by linuxer (Curate)
on Apr 06, 2009 at 12:13 UTC ( #755701=note: print w/replies, xml ) Need Help??


in reply to Re: Regex capturing
in thread Regex capturing

No, please don't, as documented in Warning on \1 Instead of $1.

With warnings enabled, you are warned about that.

echo "Hello Dolly" | perl -wlpe "s/l(lo)/\1/g" \1 better written as $1 at -e line 1.

It's better to check how to quote correctly in your shell.

The following should prevent shell's (sh, bash) interpolation of $1 as well:

echo "Hello Dolly" | perl -wlpe "s/l(lo)/\$1/g"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://755701]
help
Chatterbox?
[Tux]: no, it was not .xinput related, but that did ring a bell. digging in my $ENV I found the cause: XMODIFIERS=@im=xim
[Tux]: Héŀłő çřűèļ ŵøŗľđ, ıŧ'š ºvəř
[choroba]: ÿǎÿ!

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2017-09-25 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (290 votes). Check out past polls.

    Notices?