The real problem is that when you do
%paramhash = %$params1 you're getting a copy of the hash, and updating that copy doesn't update the original. So you'll have to keep a hashref, instead of a hash. Here's some code that should work for you. I've also modified a few other things, just for style purposes (for instance,
sort defaults to an alphabetical sort, so there's no reason to pass the block to it).
sub upd_info
{
my ($hashref, $arrayref) = @_;
for my $key (keys %{$hashref})
{
my $upd_flg = 0;
for my $item (sort @{$arrayref})
{
if ($item =~ /^$key\s+(\w+)$/)
{
$upd_flg++;
$hashref->{$key} .= " $1";
last;
}
}
if ($upd_flg == 0)
{
$hashref->{$key} .= " NONE";
}
}
}