What will be the value of $keys ? my $var; if (exists $var->{key1}->{key2}) { $var->{key1}->{key2} = 1; } my $keys = keys(%{$var});
code will fail
2
1
undef