my $key = $1; my $value = $2; $hash{ $key } .= ' ', $value; #Add the value into the hash }