use strict; use warnings; use feature 'say'; use Data::Dumper; my %hoh; while (my $line = ) { chomp($line); my ($key, $height, $color, $weight) = split(' ', $line); @{ $hoh{$key} }{qw/height color weight/} = ($height, $color, $weight); } say Dumper \%hoh; __DATA__ ef56 2.6 red 4 ef42 2.8 green 3