if (my @matches = grep {$input{$_}} qw(info1 info2 info3)) { print "Matched: @matches"; } else { print "none of the conditions were met\n"; }