sub getline { my $line; chomp ($line = <>); if (@_) { my $bool; foreach (@_) { if ($line =~ /$_/) { undef $bool } else { $bool++ } } return $bool ? $line : 0 ; } $line; # we got here because caller didnt care about what they get. }