#!/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.
In reply to Re: Writing to file and reading from same file
by jmcnamara
in thread Writing to file and reading from same file
by basm100
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |