$x =~ s/['\s+]//g; my %hash = split /[:,]/, $x; #### $x =~ s/'\s*:\s*'/' => '/g; my %hash = %{ eval "{$x}" };