Let's say I have an array, @theArr, which contains about 1000 elements, such as:
01 '12 16 sj.1012804p1012831.93.gz' 02 '12 16 sj.1012832p1012859.94.gz' 03 '12 16 sj.1012860p1012887.95.gz' 04 '12 16 sj.1012888p1012915.96.gz' 05 '12 16 sj.1012916p1012943.97.gz' 06 '12 16 sj.875352p875407.01.gz' 07 '12 16 sj.875408p875435.02.gz' 08 '12 16 sj.875436p875535.03.gz' 09 '12 16 sj.875536p875575.04.gz' 10 '12 16 sj.875576p875603.05.gz' 11 '12 16 sj.875604p875631.06.gz' 12 '12 16 sj.875632p875659.07.gz' 13 '12 16 sj.875660p875687.08.gz' 14 '12 16 sj.875688p875715.09.gz' 15 '12 16 sj.875716p875743.10.gz' ...
If my first set of numbers (between "sj." And "p") was always 6 digits, I would not have a problem. But, when the numbers are turned upside down by 7 digits, the default sorting stops working, since the larger 7-digit numbers arrive up to the smaller 6-digit number.
Is there any way to tell Perl to sort by this number inside the string in each element of the array?
source share