#!/usr/bin/perl use warnings; sub func { $a =~ s/.*_(\d+)$/$1/; $b =~ s/.*_(\d+)$/$1/; $a <=> $b; } my @array = ("0x4b82_555","0x4b82_5", "0x4b82_58","0x4b82_651", "0x4b8 +2_551"); my @result = sort func @array; print "@result";
The above code will give the result as you want.
In reply to Re: sort based upon the partial data
by nagalenoj
in thread sort based upon the partial data
by sathiya.sw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |