in reply to Writing to file and reading from same file
#!/usr/bin/perl -w use strict; # Open file for reading and writing (and maybe arithmetic) 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;
--
John.
|
|---|