arivu198314 has asked for the wisdom of the Perl Monks concerning the following question:

I want to decode the entire hash values, hash must contain lot of child hashes and arrays.

For scalar values i'm using this code

$result=decode ("UTF-8",$content);

How to do this decode for complex hash?

Replies are listed 'Best First'.
Re: Decode Hash Values
by Corion (Patriarch) on Dec 15, 2011 at 10:32 UTC

      Is there any way without extra module?

        Of course, but if you wanted to do a bunch of work reinventing wheels why did you come to us for advice?

        Is there some particular reason you think you can't use a module? Maybe you should take a look at Yes, even you can use CPAN?

        True laziness is hard work
        Are you asking for us to copy the module's contents here?

        Well, you go recursively through your hash. If ref $node eq "ARRAY" or "HASH" you loop through it (with recursion). This wheel isn't particularly hard to re-invent, for limited data sets.

Re: Decode Hash Values
by ikegami (Patriarch) on Dec 15, 2011 at 10:50 UTC
    How can you parse text into a multi-level data structure before decoding it? It sounds like you are doing things backward.