... my @matches = <$match_in>; ... while (my $lines = <$fh_in>) { for my $matches ( @matches ) { ...