use strict; use warnings; open (IN1, "; while () { foreach my $i (0..$#nets){ print "matched" if m/$nets[$i]/; } }