in reply to Sort array

A solution leveraging the inferred limit of a 2-digit number in the filename (just because TIMTOWTDI).

use strict; use warnings; use Test::More tests => 1; my @arrayUnsorted = ('page1.html', 'page11.html', 'page2.html', 'page3 +.html'); my @arraySorted = ('page1.html', 'page2.html', 'page3.html', 'page11 +.html'); my @have = sort { substr ($a, 4, 2) <=> substr ($b, 4, 2) } @arrayUnso +rted; is_deeply \@have, \@arraySorted;