in reply to Re^2: Permanently sort a hash
in thread Permanently sort a hash
use strict; use warnings; use DB_File; $DB_BTREE->{'compare'} = sub { $_[0] <=> $_[1] }; tie my %foo, "DB_File", undef, undef, undef, $DB_BTREE; for (1 .. 10) { $foo{$_} = 'value' . $_; } while(my($k, $v) = each %foo) { print "$k -> $v\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Permanently sort a hash
by ikegami (Patriarch) on Jun 04, 2009 at 17:06 UTC |