Gary Hawkins wrote: > > open FILE, "< logpass.txt"; # first line, "testing" > $line = <FILE>; > close (FILE); > > chomp($line); > $line =~ s/testing/tested/; > > open FILE, "> logpass.txt"; > print FILE $line; # first line is now "tested" > close (FILE);
This won't work properly because the line being written is shorter than the line that was read. If the original line is "testing\n", the new line will be "tested\n\n". > Should be able to open for read/write with +< instead of < but the following > apparently has something wrong with it. > > open FILE, "+< logpass.txt"; > > $line = <FILE>; > chomp($line); > $line =~ s/testing/tested/; > > print FILE $line; > close (FILE); This will read the first line and overwrite the second line with the modified copy. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]