in reply to Strange memory growth
In lvalue context,
is equivalent to$var->{$key}
so( $var //= {} )->{$key}
defined( $cg->{mainsnak}{datavalue}{value}{notexist} )
is equivalent to
defined( ( ( ( ( $cg //= {} )->{mainsnak} //= {} )->{datavalue} //= {} + )->{value} //= {} )->{notexist} )
That could potentially create a lot of new hashes.
Solution 1:
if ( $cg && $cg->{mainsnak} && $cg->{mainsnak}{datavalue} && $cg->{mainsnak}{datavalue}{value} && defined( $cg->{mainsnak}{datavalue}{value}{notexist} ) ) { ... }
Solution 2:
no autovivification; if (defined( $cg->{mainsnak}{datavalue}{value}{notexist} )) { ... }
In Section
Seekers of Perl Wisdom