while ($Fh=) { chomp($Fh); foreach $head(@headers) { chomp($head); if ($head =~ /$Fh/) { print "$Fh\n"; } } }