Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Word replace - notetab light vs perl

by blazar (Canon)
on Oct 06, 2005 at 09:56 UTC ( [id://497870]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open(FH, "wrongs") or die $!;
    open(FH2, ">wrongs2") or die $!;
    ...
    }
    close (FH);
    close (FH2);
    
  2. or download this
    perl -lpe 's/wrongs/wrongs3/' wrongs >wrongs2
    
  3. or download this
    perl -lpi -e 's/wrongs/wrongs3/' wrongs
    
  4. or download this
    perl -lpe "s/wrongs/wrongs3/" wrongs >wrongs2
    
  5. or download this
    perl -lpi.bak -e "s/wrongs/wrongs3/" wrongs
    
  6. or download this
    perl -lpi '$c++ if s/wrongs/wrongs3/; END{warn "count=$c\n"}' wrongs
    
  7. or download this
    $ time perl -lpe '$c++ if s/sex/cool/; END{warn "count=$c\n"}' gse1.lo
    +g >/dev/null 
    count=2840
    ...
    real    0m19.062s
    user    0m16.736s
    sys     0m0.940s
    
  8. or download this
    perl -lpi '$c+=s/wrongs/wrongs3/g; END{warn "count=$c\n"}' wrongs
    
  9. or download this
    perl -lpi 's/wrongs($c++)/wrongs3/g; END{warn "count=$c\n"}' wrongs
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-03-19 05:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found