in reply to Re^4: replace text using hash
in thread replace text using hash
Puts an array reference in each hash value, not the scalar value as you intend. You should only be doing this if you require a one-to-many mapping, which makes no sense in this context. What you actually want is to just assign the value:while (<DIC>) { my ( $key, $tgt ) = split(/\t/, $_); push @{ $dictionary{$key} }, $tgt; }
while (<DIC>) { my ( $key, $tgt ) = split(/\t/, $_); $dictionary{$key} = $tgt; }
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|