in reply to Re: Saving Hash Values to file
in thread Saving Hash Values to file
The first one will print out in the order specified in @saveorder, so you know which item comes where in your list. The second is just sorted, which could make for unpredictability later on in life...use strict; my %stats=('sent',0, 'recv',4, 'masters',2, 'errors',2 ); my @saveorder = qw (sent recv masters errors); print join (",", @stats{@saveorder}), "\n", join(',', sort { $a <=> $b } values %stats), "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Saving Hash Values to file
by tachyon (Chancellor) on May 07, 2002 at 06:07 UTC |