in reply to How to change an Array to a Hash
The easiest way to convert array to hash,
use strict; use warnings; use Data::Dumper; my @list= ("Andy", "1995", "Sarah", "1990", "Sam", "1992"); my %people = @list; print Dumper \%people;
Output:
$VAR1 = {
'Andy' => '1995',
'Sarah' => '1990',
'Sam' => '1992'
};
|
|---|