@files = sort { lc $a cmp lc $b } grep { /.tmp/ } readdir(DIR);
will do the first one, and for the second:
foreach $record (sort { lc $a cmp $b } keys %db_array) {
to sort case insensitive on the keys of the hash, or to sort on the values:
foreach $record (sort { lc $db_array{$a} cmp lc $db_array{$b}) {
The lc just makes the string lower case.
Hope that helps,
Alex
will do the first one, and for the second:
foreach $record (sort { lc $a cmp $b } keys %db_array) {
to sort case insensitive on the keys of the hash, or to sort on the values:
foreach $record (sort { lc $db_array{$a} cmp lc $db_array{$b}) {
The lc just makes the string lower case.
Hope that helps,
Alex