in reply to rewinding filehandle/line skipping ?


Here is a short example of writing to a file and rewinding it for reading. Note the +> in the open:
#!/usr/local/bin/perl -w use strict; open MYFILE, "+>somefile.txt" or die "Error message here: $!\n"; # Write to the file print MYFILE "These are the days\n"; print MYFILE "and these are the days\n"; # Rewind the file for reading seek(MYFILE, 0, 0); while (<MYFILE>) { print $_; } close MYFILE;

See also perlopentut.

--
John.