my @colNames = qw(first second third); my %hash; @hash{@colNames) = (unpack "A2A4A4A4", $line)[0,1,3];