in reply to Re^2: Edit Macintosh file, keeping resource fork
in thread Edit Macintosh file, keeping resource fork
open( FILE, "+<", $fileName ) or die "can't open file: $!"; while( <FILE> ) { if( s/foo/bar/g ) { seek( FILE, -(length), 1 ) or die "can't seek: $!"; print FILE; } }
Alternatively, you could read the entire file into a variable, perform your substitutions, seek to the beginning of the file, and write the contents of the variable to the file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Edit Macintosh file, keeping resource fork
by forrest (Beadle) on Feb 10, 2005 at 23:20 UTC | |
by eieio (Pilgrim) on Feb 11, 2005 at 14:25 UTC | |
by forrest (Beadle) on Feb 11, 2005 at 16:56 UTC |