http://www.perlmonks.org?node_id=1003508


in reply to Using user input to return variable typed.

Hi, myelinviolin,
Please, format your question properly.
Check this How do I post a question effectively?

I'm not sure how to call out variable names from the user input to display values that have already been calculated previously in the program

You can try this,or modify for your usage:

use warnings; use strict; my %variable_table = ( INT => 5, STR => 'HOME',); while (1) { print "What would you want to know: "; chomp( my $type = <STDIN> ); last if $type eq 'exit'; if ( exists $variable_table{$type} ) { print $type, ' : ', $variable_table{$type}, $/; } else { next; } }

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me