use strict; use warnings; my $this_key = "NOT_IN_HASH"; my $hash_ref = {}; my @items; if (0) { # this gives no error @items = map { $_->{value} } @{$hash_ref->{$this_key}}; } else { # but this generates to the expected error. @items = @{$hash_ref->{$this_key}}; }