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!