Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: The easiest way to substitute a part of the content of a file.

by eg (Friar)
on Jan 03, 2001 at 06:42 UTC ( #49442=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    rename $filename, $filename.".bak" or die "$!";
    open(IN, $filename.".bak") or die "$!";
    ...
    }
    close OUT;
    close IN;
    
  2. or download this
    open(IN, $filename) or die "$!";
    open(OUT, ">".$filename.".new") or die "$!";
    ...
    close OUT;
    close IN;
    rename $filename.".new", $filename or die "$!";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2021-04-11 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?