http://qs1969.pair.com?node_id=1086792


in reply to Re^2: 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

To get rid of the warnings, you can write

if (defined $data{$key} && $data{$key} eq $input) { ... }

Also, please do read, understand and apply Writeup Formatting Tips.

Replies are listed 'Best First'.
Re^4: Extracting single element from array to be printed in a one liner hash
by Lotus1 (Vicar) on May 20, 2014 at 17:47 UTC

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

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