while () { my @line = split; my %hash; @hash{+KEYS} = @line; push @array, {%hash}; } #### while () { my %hash; @hash{ +KEYS } = split; push @array, \%hash; }