I have a code as below
@array = qw(Sam London George Washington Luke Shanghai);
my %where = @array;
my @d = keys %where;
my @c = values %where;
print "4. keys - @d values - @c \n";
I am getting
4. keys - George Luke Sam values - Washington Shanghai London
I should be getting 4. keys - Sam George Luke values - London Washington Shanghai
Then I have
my ($a) = %where;
my $b = %where;
my $c = $b + 1;
print "6. $a $b $c \n"
Why am I getting
6. George 2/8 3
So, firstly why am I getting incorrect order when I change array to hash. Secondly, how do I get 2/8 and 3. Instead I am expecting 6 and 7, since there are 6 elements in the hash (3 hash and 3 keys).