in reply to Multiple Array Loops

Such nested loops can almost always be re-written to use hashes:
my @chains = qw(INPUT OUTPUT FORWARD); # use @chains as hash keys for %chains_h; my %chains_h; @chains_h{@chains} = (1) x @chains; my @rules = open_file($rules); for (@rules) { if ($chains_h{$_}) { print "found $_"; } }