open FH, '<', $filename or die ("Can't open $filename"); #FH is a "filehandle", and the '<' means "open in read mode" #('>' would be write) while () { #the angles around FH mean "read a line" work_with_the_line($_); # $_ holds the current line in this case # work_with_the_line would be a subroutine defined by you } close FH; #don't forget to close files!