in reply to foreach loop
open(IN,"myfile.txt"); [download]
while(<IN>){ each line of your file is iterated over... the contents of each line are stored in the variable $_ } [download]