Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Extracting single element from array to be printed in a one liner hash

by wildguess123 (Initiate)
on May 20, 2014 at 14:02 UTC ( #1086791=note: print w/ replies, xml ) Need Help??


in reply to Re: Extracting single element from array to be printed in a one liner hash
in thread Extracting single element from array to be printed in a one liner hash

I got the following error when u changed the foreach loop to yours:

Please enter a string apple Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Use of uninitialized value $data in hash element at p3task6.pl line 30 +, <STDIN> line 2. Use of uninitialized value in string eq at p3task6.pl line 30, <STDIN> + line 2. Please enter a string


Comment on Re^2: Extracting single element from array to be printed in a one liner hash
Download Code
Re^3: Extracting single element from array to be printed in a one liner hash
by moritz (Cardinal) on May 20, 2014 at 14:07 UTC

      The OP wanted to type apples for example and have it say "fruits". To do this you need:

      if ( $key eq $input ) { ... }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1086791]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-12-25 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls