foreach (@options) { if(exists $hash{$_}) { # always true for $_='fail' &do_something($_); last; } }