in reply to Re: Hash from prompt
in thread Hash from prompt
I have even tried taken out the concatenation on the print line but still get an error. Any help would be appreciated. Randy### create a hash my %fruit_num = ( apple => 3, bananas => 1, oranges => 2, ); ### promp the user to enter a key ### use the input to dispaly the value with that key. print "Which fruit do you whish to query? "; my $fruit = <STDIN>; chomp $fruit; my $fruits = $fruit_num{$fruit}; print "Number of" . $fruit . "is" . $fruits . " \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Hash from prompt
by Athanasius (Cardinal) on Oct 13, 2014 at 04:37 UTC | |
|
Re^3: Hash from prompt
by rshoe (Novice) on Oct 13, 2014 at 04:35 UTC | |
by AnomalousMonk (Archbishop) on Oct 13, 2014 at 15:08 UTC |