my @SList = qw(Name Latitude Longitude); my @AoH; while () { chomp; my %hash; @hash{@SList} = split; # left-hand-side is called a "hash slice" push @AoH, \%hash; }