http://qs321.pair.com?node_id=345019


in reply to doing a search and replace on a large file

Just about the way you outlined:
open(INPUT,"<$bigfile") ||die "Could not open $bigfile:$!\n"; open(OUTPUT,">$newfile")||die "Could not open $newfile:$!\n"; while (<INPUT>) { print OUTPUT $_ # note no semicolon here... unless /whatever condition matches the patterns you want/; } close(INPUT) || die "Could not close $bigfile: $!\n"; close(OUTPUT)|| die "Could not close $newfile: $!\n";