# Convert a . to }->{ in order for meta.created to look like meta}->{created $element =~ s/\./}->{/g; # This works for all elements except of meta}->{created $deref = $item->{$element}; print "Convert: \$item->{" . $element . "}\t\t\t" . $deref . "\n"; }
I think you are trying to achieve something with a sort of "meta-coding" which is quite dangerous: when you write $item->{$element} you're try to access the hash $item value with a key like "...}->{..." which is why you then get that error, because there isn't such a key!
If you really want to do such a sort of meta-coding, then you need to write for instance "$item->{".$element."}" and then you can try to eval() that thing. Why instead not trying one of the modules recommended by haukex ?
In reply to Re: Dynamic Dereferencing
by markong
in thread Dynamic Dereferencing
by Flip76
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |