Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Modifying File Contents

by HuckinFappy (Pilgrim)
on Mar 19, 2006 at 03:30 UTC ( [id://537712]=note: print w/replies, xml ) Need Help??


in reply to Modifying File Contents

Use the IO::InSitu module:
use IO::InSitu; my ( $src, $dest ) = open_rw( 'my_file', 'my_file' ); while ( my $line = <$src> ) { # If this is the line you want to modify # Call a routine to modify either the minor or # major version, depending on the case in question # by modifying $line print {$dest} $line; }
Thanks to the Damian for this one!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-25 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found