in reply to Perl autovivifyies object property when using exists

This is a pervasive gotcha in perl. You need to check the existence of any parent references whose existence you are unsure of before checking their children. Otherwise the parents will pop into existence.
  • Comment on Re: Perl autovivifyies object property when using exists

Replies are listed 'Best First'.
Re^2: Perl autovivifyies object property when using exists
by nysus (Parson) on Apr 03, 2024 at 19:13 UTC

    Ah, got it. Thanks. Quite the little gotcha. Never knew about this.

    $PM = "Perl Monk's";
    $MC = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar Parson";
    $nysus = $PM . ' ' . $MC;
    Click here if you love Perl Monks