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

Re^5: Corrector

by dmorgo (Pilgrim)
on Dec 29, 2008 at 01:21 UTC ( #732943=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Corrector
in thread Corrector

Technically correct if the OP's true intention was to replace only the first occurrence of each item in each line where it occurs. I tend to believe the OP probably wanted to replace all occurrences, not just one per line. I know you, jdporter (dmorgo bows) already know what character is missing ;-) but for the OP's benefit, adding a 'g' modifier would do the trick:

#!/usr/bin/perl -pi s/this/that/g; # substitutes this with that s/one/two/g; # substitutes one with two


Comment on Re^5: Corrector
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2016-02-12 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (395 votes), past polls