in reply to Convert string to variable
The better way is to use a hash. You already know how to do it, just create another hash alongside %var_list (which could be better named %questions):
my %questions = (date_in => 'Start Date', date_out => 'End Date', ); my %answers; for my $key (keys %questions) { $answers{$key} = prompt($questions{$key} . ': '); }
Alternatively, you can store all the information in one hash:
my %questions = (date_in => { q => 'Start Date' }, date_out => { q => 'End Date' }, ); for my $key (keys %questions) { $questions{$key}{a} = prompt($questions{$key}{q} . ': '); }
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Convert string to variable
by stevieb (Canon) on Feb 16, 2018 at 22:53 UTC |