in reply to Re^2: Hash search and returning by value
in thread Hash search and returning by value

Can "grep" take a condition, like only assign to "$zip_match" if it is true?

In the statement
    my ($zip_match) = grep { $_ eq $zip } values %zips;
the condition grep takes is  $_ eq $zip and it matches in list context, so it returns nothing (the empty list) if there is no match and assigns nothing to  $zip_match which retains the uninitialized value (i.e., undef) with which it was created.