truthseeker66 has asked for the wisdom of the Perl Monks concerning the following question:
When I run this script why do I get the keys and values not in order?
Thank you,
Thank you,
#!/usr/bin/perl use strict; use warnings; my%hash1 = ("a",1,"b",2,"c",3,"d",4); while (my@values = each(%hash1)){ print "The key/value pair is @values \n"; }
C:\JPARK\JPERL>test.pl
The key/value pair is c 3
The key/value pair is a 1
The key/value pair is b 2
The key/value pair is d 4
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Not in order in Hash output
by toolic (Bishop) on Oct 10, 2012 at 19:49 UTC | |
Re: Not in order in Hash output
by aitap (Curate) on Oct 10, 2012 at 19:51 UTC | |
Re: Not in order in Hash output
by ikegami (Patriarch) on Oct 10, 2012 at 22:30 UTC | |
by perl_walker (Novice) on Oct 11, 2012 at 12:34 UTC | |
Re: Not in order in Hash output
by MidLifeXis (Monsignor) on Oct 11, 2012 at 12:37 UTC | |
Re: Not in order in Hash output
by johngg (Canon) on Oct 10, 2012 at 20:19 UTC |
Back to
Seekers of Perl Wisdom