Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: open file for read/write

by l.frankline (Hermit)
on Dec 08, 2005 at 15:01 UTC ( [id://515256]=note: print w/replies, xml ) Need Help??


in reply to open file for read/write

open(FH, "+<", "$filename") or die "Opening: $!"; @ARRAY = <FH>; # change ARRAY here seek(FH,0,0) or die "Seeking: $!"; for($i=0;$i<=$#ARRAY;$i++) { $line = $ARRAY[$i]; $line=~s#find#replace#; $ARRAY[$i] = $line; } print FH @ARRAY or die "Printing: $!"; truncate(FH,tell(FH)) or die "Truncating: $!"; close(FH);

regards
Franklin

Don't put off till tomorrow, what you can do today.

Replies are listed 'Best First'.
Re^2: open file for read/write
by VSarkiss (Monsignor) on Dec 08, 2005 at 15:20 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-25 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found