use strict; use warnings; use Data::Dumper; my $this_key = "NOT_IN_HASH"; my $hash_ref = {}; my @items; @items = map { $_->{value} } @{$hash_ref->{$this_key}}; print Dumper \@items; my @x; foreach (@{$hash_ref->{$this_key}}) # loop does not execute # because array is empty { print "loop is looping\n"; #This doesn't ever print ! push @x, $_->{value}; } print Dumper \@x; my @nothing; print Dumper \@nothing; __END__ Prints: $VAR1 = []; #print Dumper \@items; $VAR1 = []; #print Dumper \@x; $VAR1 = []; #print Dumper \@nothing;