in reply to Re^3: Array to hash converstion
in thread Array to hash converstion
If two keys are same then, output is#!/usr/bin/perl -w use strict; my @value_pairs = qw (one abc two xyz); my %hash = @value_pairs; foreach my $key (keys %hash) { print "key $key is $hash{$key}\n"; } __END__ prints: key one is abc key two is xyz key one is def
so for the key one value is def is not printed here. The expected output iskey one is abc key two is xyz
Please tell me how can I get the output like thiskey one is abc key two is xyz key one is def
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Array to hash converstion
by dsheroh (Monsignor) on Jul 15, 2009 at 09:41 UTC | |
by gem555 (Acolyte) on Jul 15, 2009 at 10:25 UTC | |
by Anonymous Monk on Jul 15, 2009 at 10:41 UTC |
In Section
Seekers of Perl Wisdom