try this:If you want to do it in one clean open/ close sequence (using +< as the open command, like you had originally) simply do it like Darbesio suggested above but where he closes and opens the file again truncate the file to zero-length (look up "truncate" on perldoc) and then seek to the beginning of the file (look up "seek" too) then do your writes. should look something like this:
my $source_file = "searchandreplace.txt"; open(IN,"<$source_file") || die "can't open file: $1"; while(<IN>) { $row = $_; $row =~ s/\s+\w+//i; push(@arr, $row); } close(IN);
open(OUT,">$source_file" ) || die "can't open file: $1"; foreach (@arr) { print OUT $_; } close(OUT);
truncate FILE, 0;
seek FILE, 0, 0;
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]