./test.pl r,2,g,2,w,1 #### #!/usr/bin/perl use Data::Dumper; my $arg = shift; my %actualhash = eval $arg; print Dumper \%actualhash; #### $VAR1 = { 'w' => 1, 'r' => 2, 'g' => 2 }; #### ./test.pl r,2,g,2,w,1,q,1 $VAR1 = {};