my %stacks; my $CurrentArrayRef = $Stacks{nonexistant} || []; # Line above CREATES a ref to an empty array if the stack was undefined. #It returns a ref to the contents if there were any. push @$CurrentArrayRef, "New Value"; ... more code ... # Now (re)store the contents into the stack $Stacks{nonexistant} = $CurrentArrayRef;