perl按照健值排序
perl中如何将按hash key值排序
BRUSH2 10752 11263 BUFFER 11264 11775 MEGASONIC 11776 12287 INPUTMODULE 12800 13823 DRYER 14336 14847 EFEM 14848 15359 WAFERINPUTE 15360 15871 STATIONROBOT 15872 16383 PIN 16384 16895 POUT 16896 17407 FLITBEAM 17408 18431 ITP 18432 19455 PLATEN 23040 23551 HEAD 26624 27135 PAD_CONDITIONER 28160 28671 SLURRY_ARM 30720 31231 WTP 33792 35327 CARRIER 35328 36863 SYSTEM 8192 8703 SCHEDULER 8704 9215 BRUSH1 9216 9727
排序后的结果为
SYSTEM 8192 8703 SCHEDULER 8704 9215 BRUSH1 9216 9727 BRUSH2 9728 10239 BUFFER 11264 11775 MEGASONIC 12288 12799 INPUTMODULE 12800 13823 DRYER 14336 14847 EFEM 14848 15359 WAFERINPUTE 15360 15871 STATIONROBOT 15872 16383 PIN 16384 16895 POUT 16896 17407 FLITBEAM 17408 18431 ITP 18432 19455 PLATEN 23040 23551 HEAD 25600 26111 PAD_CONDITIONER 28160 28671 SLURRY_ARM 31744 32255 WTP 33792 35327 CARRIER 35328 36863
for my $key (sort{$H_SVID{$a}{MINID}<=>$H_SVID{$b}{MINID}} keys %H_SVID)#按照MINID(为数字,如果是字符串将<=>改为cmp)从大到小排列 { print "$key\t$H_SVID{$key}{MINID}\t$H_SVID{$key}{MAXID}\n"; }
4556