... my @matches = <$match_in>; ... while (my $lines = <$fh_in>) { for my $matches ( @matches ) { ... #### #!/usr/bin/perl use strict; open my $fh1, '<', 'file_iterator1'; open my $fh2, '<', 'file_iterator2'; while ( my $line1 = <$fh1> ) { chomp $line1; while ( my $line2 = <$fh2> ) { chomp $line2; print "$line1:\t$line2\n"; } } #### one two three #### ay bee see #### one: ay one: bee one: see