use strict; use warnings; use Data::Dumper; my @array = qw( sean connery george lazemby roger moore timothy dalton pierce brosnan ); my $hash_ref = populate_hash(\@array); print Dumper $hash_ref; sub populate_hash { my $array_ref = shift; my %hash; for (0..4) { my ($key, $val) = splice @$array_ref, 0, 2; $hash{$key} = $val; } return \%hash; }