foreach my $var (@somearray){ if($var eq "foo"){ someaction(); last;} }