1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl -w use strict; use warnings; my %test = ( a => 1, b => 2, c => 3, d => 4, ); foreach ( sort {$a cmp $b} keys %test ) { print "$_ -> $test{$_}\n"; }
2011-04-28T17:39:05 biancaHabe sort {$a eq 'c' || $a cmp $b} probiert, das stellt c ans Ende statt an den Anfang.
Bei sort {$b eq 'c' || $a cmp $b} steht es an zweiter Stelle statt am Anfang.