my $string; for( @regexes ) { if( @matches = $string =~ $_->{regexp} ) { $_->{code}->($string, @matches); } }