in reply to reading multiple files one at a time

I only included the last to print only the first line so I could sort through the output easier. OeufMayo sent me this answer that works well, although I'm not sure of the difference. Maybe something to do with $_? If someone can explain, I will listen!
foreach (@filenames){ open F, $_ or warn $!; while(<F> ){ print "$_\n"; last; } }
Thanks again OeufMayo!