Is the data of fixed width? If so, you're better off with unpack:
# @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;
}
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated