......
"\L$last_name{$a}" cmp "\L$last_name{$b}"
or
"\L$a" cmp "\L$b"
.....
......
"\L$a" cmp "\L$b"
or
"\L$last_name{$a}" cmp "\L$last_name{$b}"
.....
原帖由 ubac 于 2006-8-2 08:22 发表
哈希数组的元素在内存中存储顺序是无序的
任何一个元素都有可能最先被打印出来
原帖由 CalmIce 于 2006-8-1 16:16 发表
#!/usr/bin/perl -w
my %last_name = qw [fred flintstone Wilma Flintstone Barney Rubble betty rubble Bamm-Bamm Rubble PEBBLES FLINTSONE];
my @keys=sort
{
"\L$last_name{$a}" ...
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |