use strict; my (@arr1); $arr1[0] = "john:::10"; $arr1[1] = "bill:::9"; $arr1[2] = "mary:::35"; $arr1[3] = "willy:::21"; ##################### sub comparesimple { (split /:/,$a)[-1] # Take last element of split.. <=> # Do numeric compare (split /:/,$b )[-1] } ############################## print qq($_ \n) for sort comparesimple @arr1;
Earth first! (We'll rob the other planets later)
In reply to Re: Sort array1 according to sorting of array2
by NetWallah
in thread Sort array1 according to sorting of array2
by noname00
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |