On Fri, 24 Sep 2004, brian larochelle wrote:

> ordered hash

Hashes are, almost by definition, unordered lists of key/value pairs. 

If you want to work with one in order, add a sort command to accesses:

  my @sorted_keys = sort keys %hash;

  foreach $key @sorted_keys {
    my $value = $hash{$key};
  }

etc.

Or just

  foreach $key ( sort keys %hash ) {
    my $value = $hash{$key};
  }

to skip the temp variable.

Make sense ?



-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to