in reply to When greedy constructs do battle, can I choose the winner?

Yes, by placing it first.

my ($last_five) = map scalar reverse, map /^(?>0*)(\d{1,5})/, map scalar reverse, $running_total;

But note that I had to add (?>...) in order to prevent backtracking in the situation where the input is "0000". It's simpler to make sure the last of 5 isn't a 0.

my ($last_five) = $running_total =~ /(\d{0,4}[^0\D])0*$/;

or

my ($last_five) = $running_total =~ /(\d{1,5}(?<!0))0*$/;

In all of the above solutions, $last_five will be undef if there's no match.

Tested.