in reply to my array is almost a hash, but keys are not unique.

Let's have a look at your data:

#! /usr/bin/perl use strict; use warnings; use Data::Dumper; # this remains a plain array! # '=>' is a 'fat comma', so we have a simple list # with '=>' you don't need to quote the string to its left my $in = [ one => 1, two => 2, two => '2.003' ]; print Dumper( $in ); __END__ $VAR1 = [ 'one', 1, 'two', 2, 'two', '2.003' ];

To transform the array into a hash (of arrays), the following should do the job:

my %hash; while ( my ( $key, $val ) = splice( @$in, 0, 2 ) ) { push @{ $hash{$key} }, $val; }

Update: