You might also want to add a little data filtration on the keys and values to at least strip leading and trailing whitespace otherwise "a=>4" will generate a different key to say " a =>4". Something like:
foreach (split /,\s*/, param('hashdata')) {
my ($k, $v) = split(/=>/);
whitespace(\$k,\$v);
$hash{$k} = $v;
}
sub whitespace {
while (my $ref = shift){
$$ref =~ s/^\s+|\s+$//g
}
}
We pass the sub references to the variables so we can change them in the sub and not bother having to return the changed values and assign them.
cheers
tachyon