Let's assume that I have a complex hash reference $hash_ref, and I would like to access data in it by doing something like this:
my $string1 = "{books}";
my $string2 = "{31335}->{book_name}";
print Dumper($hash_ref->$string1->$string2);
Of course, this doesn't work, but I hope it explains what I'd like to do.
Obviously, there are many ways I can make this work, but I am (out of curiosity) really interested to figure out if there is some Perl magic that could make this work without splitting strings, etc.
I know that I could create 3 strings ("books", "31335", "book_name")
and have this done in a second, and there are certainly other ways, but I never understood if one could actually access hash data by using strings that represent hash structure, like in the above example.
Thanks :)