|
|
| Do you know where your variables are? | |
| PerlMonks |
How can I make my hash remember the order I put elements into it?by faq_monk (Initiate) |
| on Oct 08, 1999 at 00:20 UTC ( #633=perlfaq nodetype: print w/ replies, xml ) | Need Help?? |
|
Current Perl documentation can be found at perldoc.perl.org. Here is our local, out-dated (pre-5.6) version: Use the Tie::IxHash from CPAN.
use Tie::IxHash;
tie(%myhash, Tie::IxHash);
for ($i=0; $i<20; $i++) {
$myhash{$i} = 2*$i;
}
@keys = keys %myhash;
# @keys = (0,1,2,3,...)
|
|