in reply to Explanation of mapping and undef

map { $_ => undef } qw(city state country) creates the list (city => undef, state => undef, country => undef). This is an idiomatic way to initialize a hash from a list of values (used as keys).

Anyway, the code:

next if exists { map {$_ => undef } qw(city state country) } -> { $field };

is redundant and too 1337 for its own good. I would write:

next if grep {$_ eq $field} qw(city state country);

Update: oops, my mind was captured by the other grep :)

Replies are listed 'Best First'.
Re^2: Explanation of mapping and undef
by Anonymous Monk on Jun 08, 2004 at 11:58 UTC
    Thanks!