>>>>> "Mok" == Mok T Y <[EMAIL PROTECTED]> writes:
Mok> Hi, I need some help in converting strings that contain numbers Mok> back into numeric form. Apparently, when I sort string Mok> formatted number, the arrangement was according to alphanumeric Mok> order (eg. 1, 10,11,2,20,21,3,30... ). Thanks, TY Since Perl doesn't make your declare your variables' type when you create them, you need to tell it what kind of data you have when you use the variable. In this case, you're sorting lexically rather than numerically. Use a sort function like: @results = sort {$a <=> $b} @array; # an ascending numerical sort. instead of: @results = sort @array; # which is equal to sort {$a cmp $b} @array. The difference is '<=>' (numerical comparison) against 'cmp' (lexical comparison). Hope this helps. perldoc -f sort for more information. - Chris. -- $a="printf.net"; Chris Ball | chris@void.$a | www.$a | finger: chris@$a As to luck, there's the old miners' proverb: Gold is where you find it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]