in reply to What's like $+ but not gives the ordinal?

Close?
I tested it with a variety of cases, and I think it does what you're looking for.
my @subs = (\&hi, \&bye, \&bueno, \&vivid); my $foo="here is a test for you"; if ($foo=~/(hyah)|(is)|(a)|(yodu)/){ #pass my $m = &lastmatch; print "--$m--"; --$m; &{$subs[ $m]}; } sub lastmatch { my $found; for (1..10) {#whatever is appropriate. if (eval ("\$\$_")) {$found = $_; next;} return $found if $found;#short circuit for loop } } sub hi {print "hi"} sub bye {print "bye"} sub bueno {print "bueno"} sub vivid {print "vivid"}