my %hash; sub list { print join( ' ', sort keys %hash ), $/ } for( $hash{for} ) { # Don't do a single thing to $_ } list(); # 'for' entry autovivified unconditionally sub maybeset { for( $_[0] ) { $_ = $_[1] if 1 < @_ }; list() } maybeset( $hash{maybe} ); # no 'maybe', despite the for() in the sub maybeset( $hash{set}, 'hello' ); # now 'for set'