in reply to Assigning list with duplicate keys to hash
And the output is (for Active State Perl 5.8.8):#!/usr/bin/perl use warnings; use strict; my @array = ( 'A', 1, 'B', 2, 'C', 3, 'A', 4 ); my %hash = @array; for (sort keys %hash ) { print "$_ => $hash{$_}\n"; } print "\n";
C:\Code>perl array-hash-order.pl A => 4 B => 2 C => 3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Assigning list with duplicate keys to hash
by mscharrer (Hermit) on Apr 22, 2008 at 15:06 UTC | |
|
Re^2: Assigning list with duplicate keys to hash
by bgs (Initiate) on Aug 03, 2010 at 06:37 UTC | |
by toolic (Bishop) on Aug 03, 2010 at 13:12 UTC |