http://qs321.pair.com?node_id=745914


in reply to (Mis)Understanding grep...eq $_

grep EXPR, LIST
Evaluates the BLOCK or EXPR for each element of LIST (locally setting $_ to each element) and returns the list value consisting of those elements for which the expression evaluated to true.
So, in this case, grep takes a list and returns a list.
my @list = (1, 2, 3, 4, 5); my @result = grep $_ > 2, @list; print "@result";
3 4 5
You could probably get away with something like
if (exists $item_lookup{$name}){ print qq{$name has $item_lookup{$name}}; else{ print qq{$name is missing $item_lookup{$name}; }
in your for loop.