in reply to How do I read the contents of a file?

All you need to do is use open:
open FILEHANDLE, filename;
Then all you have to do is read from your FILEHANDLE with <FILEHANDLE>. If you assign this to a scalar like $line=<FILE>, you'll get one line. However if you set it equal to an array like @lines=<FILE> you'll get all the lines.

Then you should use close when you're finished reading from the file:

open FILE, "myfile" or die "Couldn't open: $!"; @lines=<FILE>; #get all the lines from the file close FILE;
open FILE2, "myfile2" or die "Couldn't open: $!"; while(<FILE2>){ #reads in from the file a line at a time and puts it +in the default variable print $_; #print the default variable $_ which the line is stor +ed in. } close FILE2;