# first populate array with zipcodes from zipcodes # text file. # --- No problem here my $file = "zipcodes.txt"; open (FH, "< $file") or die "Can't open $file for read: $!"; my @zipcodes; while () { push (@zipcodes, $_); } close FH or die "Cannot close $file: $!"; # open the text file for processing looking only for # lines of text with a zipcode from the array @zipcodes # --- here is the problem as it outputs nothing while (my $line = ) { foreach my $zipcode (@zipcodes) { if ($line =~ m/$zipcode/) { print $line; } } }