sub last_match { # Accepts no args # Returns the digit of the last parenthesis match or undef if there isn't one my $match_num = 1; if(defined($$match_num)) { while(defined($$match_num)) { $match_num++; } $match_num--; } else { undef $match_num; } return $match_num; }