in reply to
Using user input to return variable typed.
I agree with others' design suggestions. However, it is worth noting that it is possible to do exactly what you requested:
my ($thing,$foo,$blah) = (1,2,3);
print "What would you like to know? ";
my $result = eval "\$$_";
print "bad variable name\n";
Generally speaking, eval is not "good design". Why not? Because the user could type this:
What would you like to know? foo;system("any malicious command here")
You could make this somewhat safer by sanitizing your input, but it is still better to avoid eval in production code. Besides the security issue, it also makes for confusing, hard to maintain code.
Nevertheless, I wanted to point this out because it can be very useful, especially for the quick-and-dirty tasks that Perl handles so well.
When's the last time you used duct tape on a duct? --Larry Wall