The reason you run into difficulties is the operator, <=> is the numerical comparison, cmp is the default value, and this is string comparison.
$ perl -E'say for sort qw/01 1 02 200/'; 01 02 1 200
With a little change, we get something much closer to the rule:
$ perl -E'say for sort { $a <=> $b } qw/01 1 02 200/'; 01 1 02 200
However, in your case, you need to delete unnecessary numbers.
$ perl -E'say for sort { my $s1 = $a =~ m/(\d+)/; my $s2 = $b =~ /(\d+)/; $s1 <=> $s2 } qw/01 1 02 200/'; 01 1 02 200
Here he is prettier:
sort { my $s1 = $a =~ m/(\d+)/; my $s2 = $b =~ /(\d+)/; $s1 <=> $s2 }
This is not perfect, but it should give you a good idea of your grade problem.
Oh, and as a continuation, Shcwartzian Transform solves another problem: it prevents you from performing a difficult task (unlike the one you need - a regular expression) for a while in the search algorithm. This is due to the need to cache results (not in order to be unexpected). Essentially, what you do is map the input of the problem to the output (usually in an array) [$input, $output] , then you sort the outputs $a->[1] <=> $b->[1] . Now that your data is sorted, you will go back to get the original inputs $_->[0] .
map $_->[0], sort { $a->[1] <=> $b->[1] } map [ $_, fn($_) ] , qw/input list here/ ;
This is great because it is so compact, being so effective.