in reply to Length of first captured match

It may be that this is what you are after:

'abc12345' =~ /(\d+)$/; print $+[1] - $-[1];

Prints:

5

DWIM is Perl's answer to Gödel