in reply to Re^2: XML::Simple for sequence in xsd
in thread XML::Simple for sequence in xsd
Note that %myhash preserves the order, whereas %myotherhash (which is not tied to Tie::IxHash) does not preserve the order.use strict; use warnings; use Tie::IxHash; my %myhash; my %myotherhash; tie %myhash, 'Tie::IxHash'; for (my $i=0; $i<7; $i++) { $myhash{$i} = 2*$i; } my @keys = keys %myhash; print "@keys\n"; for (my $i=0; $i<7; $i++) { $myotherhash{$i} = 2*$i; } @keys = keys %myotherhash; print "@keys\n"; __END__ Output: 0 1 2 3 4 5 6 6 4 1 3 0 2 5
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: XML::Simple for sequence in xsd
by moritz (Cardinal) on Aug 18, 2007 at 16:28 UTC | |
|
Re^4: XML::Simple for sequence in xsd
by Sham (Novice) on Aug 20, 2007 at 06:34 UTC | |
by syphilis (Archbishop) on Aug 20, 2007 at 11:11 UTC | |
by syphilis (Archbishop) on Aug 20, 2007 at 12:47 UTC | |
by Anonymous Monk on Aug 23, 2007 at 15:10 UTC |