in reply to Re^2: unblessed reference problem
in thread unblessed reference problem
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: unblessed reference problem
by gdolph (Novice) on Mar 26, 2010 at 12:22 UTC |