but I still want to know how it works
If you're referring to the eval thing, that would be:
#!/usr/bin/perl -l use strict; use warnings; my $hash = { domain => { foo => { bar => "baz" } } }; my $domain = "domain"; my $var1 = "foo"; my $var2 = "bar"; my $test = '{$var1}{$var2}'; my $value = eval '$hash->{$domain}'.$test; print $value; # "baz"
That said, better stay away from eval unless you know what you're doing, because
In reply to Re^3: unblessed reference problem
by almut
in thread unblessed reference problem
by gdolph
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |