[tpm] Breaking a string up into hash keys
Quantum Mechanic
quantum.mechanic.1964 at gmail.com
Sat Apr 13 07:18:27 PDT 2013
You could use s/// and an eval, if there's no security issue. Otherwise, treat it like a linked list, and walk the plank.
Cheers,
Shaun
On Apr 13, 2013, at 6:29 AM, Digimer <lists at alteeve.ca> wrote:
> Hi all,
>
> I've got a rather large, random-depth hash. ie:
>
> $conf->{foo}{bar} = "a";
> $conf->{baz} = "1";
> $conf->{this}{and}{the}{other}{thing} = "what?";
>
> And so on. The number of hash keys can be quite varied, depending on the use.
>
> So now I want to be able to take a string that is in the format:
>
> foo::bar
> baz
> this::and::the::other::thing
>
> Split on the :: and use that to pull the value out of the hash.
>
> Any help would be much appreciated! :)
>
> --
> Digimer
> Papers and Projects: https://alteeve.ca/w/
> What if the cure for cancer is trapped in the mind of a person without access to education?
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
More information about the toronto-pm
mailing list