我在Perl的初學者,我試圖從「開始的Perl:柯蒂斯坡」運行這個樣本例如行爲無法理解Perl散列的訂貨
#!/perl/bin/perl
use strict;
use warnings;
use diagnostics;
my $hero = 'Ovid';
my $fool = $hero;
print "$hero isn't that much of a hero. $fool is a fool.\n";
$hero = 'anybody else';
print "$hero is probably more of a hero than $fool.\n";
my %snacks = (
stinky => 'limburger',
yummy => 'brie',
surprise => 'soap slices',
);
my @cheese_tray = values %snacks;
print "Our cheese tray will have: ";
for my $cheese (@cheese_tray) {
print "'$cheese' ";
}
print "\n";
上面的代碼的輸出,當我試圖在我的activeperl與Windows7系統和codepad.org
Ovid isn't that much of a hero. Ovid is a fool.
anybody else is probably more of a hero than Ovid.
Our cheese tray will have: 'limburger''soap slices''brie'
我不跟三線清晰,其打印「limburger''soap slices''brie」,但哈希順序是有「limburger''brie」」肥皂片「。
請幫我理解。