What you are trying to do is use a symbolic reference. This is almost always a bad idea. You should use a dispatch table or even a series of if/elsif statements. You could do it using eval but that is dangerous unless you know what you are doing. You can do it like this provided you turn off strict:
no strict 'refs'; my $var1 = 'foo'; &$var1('Roghue, symbolic refs are bad practice'); sub foo { print "Hello $_[0]\n" }
cheers
tachyon
In reply to Re: Interpolating inside Net::DNS
by tachyon
in thread Interpolating inside Net::DNS
by Roghue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |