Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Welcome to the Monastery
 
PerlMonks  

Re: updating a file

by broquaint (Abbot)
on Nov 29, 2001 at 00:20 UTC ( #128165=note: print w/ replies, xml ) Need Help??


in reply to updating a file

While you've got the right idea by open()ing the file in read/write mode, it doesn't work quite as one would hope. You may want to try using the inplace command line switch like so

perl -pi -e 's/search_re/replace_re/g' $your_files_here
For more info on those lovely little switches check out the manual. Also you may want to be a little (see. A LOT) cautious of the infamous dot-star (i.e .*). You can learn of it's dodgy dealings from Ovid here.
HTH

broquaint


Comment on Re: updating a file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2013-05-20 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (405 votes), past polls