# @LIST_OF_ENTRIES contains your data, one line per element my %description_hash; foreach my $entry (@LIST_OF_ENTRIES) { # Replace 20 with the number of characters in the value portion my ($value, $name) = unpack('A20 A*', $entry); $value =~ s/\A\s*//; $value =~ s/\s*\z//; $description_hash($name} = $value; }