in reply to Python dict to perl hash
Not sure if this is helpful or not but for rot13, there is Crypt::Rot13 on CPAN. Just a reminder to check CPAN for everything first....
Now my code would be simpler:
my $x = ... my %hash = map { s/(^'|'$)// } split /(:|, )/ $x;
That assumes you want something like
%x = ( a => 'n', b => 'o', ...);
But it also looks trivial to convert this to valid json and use that module
Update: On second thought that above approach won't work. I think you will need to do something like:
my $x = ... my %hash = map { my $v = $_; $v =~ s/(^'|'$)//; $v} split /(:|, )/ + $x;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Python dict to perl hash
by jeffa (Bishop) on Mar 30, 2015 at 16:16 UTC | |
by einhverfr (Friar) on Mar 31, 2015 at 06:17 UTC |