in reply to Python dict to perl hash

use strict; use warnings; use Inline Python => <<'EOP'; def rot13(): return dict({ 'a':'n', 'b':'o', 'c':'p', 'd':'q', 'e':'r', 'f':'s', 'g':'t', + 'h':'u', 'i':'v', 'j':'w', 'k':'x', 'l':'y', 'm':'z', 'n':'a', 'o':'b', + 'p':'c', 'q':'d', 'r':'e', 's':'f', 't':'g', 'u':'h', 'v':'i', 'w':'j', + 'x':'k', 'y':'l', 'z':'m', 'A':'N', 'B':'O', 'C':'P', 'D':'Q', 'E':'R', + 'F':'S', 'G':'T', 'H':'U', 'I':'V', 'J':'W', 'K':'X', 'L':'Y', 'M':'Z', + 'N':'A', 'O':'B', 'P':'C', 'Q':'D', 'R':'E', 'S':'F', 'T':'G', 'U':'H', + 'V':'I', 'W':'J', 'X':'K', 'Y':'L', 'Z':'M'}) EOP my $hash = rot13 ();

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^2: Python dict to perl hash
by LanX (Saint) on Mar 31, 2015 at 15:48 UTC
    What happens in the general case with nested data structures?

    This looks like only returning a flat list...

    Or am I undervaluing the power of inline python?

    update

    Sorry, I didn't realize that $hash IS a scalar (I read %hash), that should answer the question already.

    Never mind. :)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    PS: Je suis Charlie!