in reply to Python dict to perl hash
$x =~ s/['\s+]//g; is most likely not doing what you think it does. You might mean s{(?:'|\s+)}{}, but what if any of the dict entries has a quote, a comma of whitespace in general?