in reply to Re: Python dict to perl hash
in thread Python dict to perl hash
I think replacing this:
$x =~ s/['\s+]//g; my %hash = split /[:,]/, $x;
with this:
$x =~ s/'\s*:\s*'/' => '/g; my %hash = %{ eval "{$x}" };
would make it less breakable (but still breakable if and keys or values contained something like "' : '").
|
---|
In Section
Seekers of Perl Wisdom