* Fixed sort example using =(\d+)
The example wanted to sort a list like qw(=1 =2 =a =3 =d). One
example tried to be clever with array indices and precomputed
an array in @nums. However, it forgot to leave holes for the
elements where it could not extract a run of digits. Once the
indices were misaligned, the sort didn't give the right answer.
I know you can read the patch, but since I fixed whitespace too,
a simple diff gives you a lot of output. The old example had:
for (@old) {
push @nums, /=(\d+)/;
push @caps, uc($_);
}
The new one keeps the indices aligned by using undef when the
match failed:
for (@old) {
push @nums, ( /=(\d+)/ ? $1 : undef );
push @caps, uc($_);
}
This issue was reported on Stackoverflow:
http://stackoverflow.com/questions/1754441