I want to add something to an existing key of a hash.
$hash{key}=$val; will replace the content of key with a new content $val but will not add $val to the already existing content of key. If I try to use push to add the new value to the exisiting content then perl will give an error message : Type of arg 1 to push must be array (not hash elem.
Comment on Re: How do I push new data into an existing hash?
Try $hash{$key} .= $val; if $hash{$key} is a (string) scalar, or push @{$hash{$key}}, $val if $hash{$key} is an array reference. See perldoc perlref and perldoc perlreftut for more on how to play with references.