open LOG, "mylogfile.txt" or die "Cannot open file $!"; while () { #do some stuff with data } close LOG; #### open LOG, "mylogfile.txt" or die "Cannot open file $!"; while () { print $_; # this will print out the value of $_ so you can # check it to make sure it is what you want to be # processing. } close LOG;