in reply to Re^2: detecting an undefined variable
in thread detecting an undefined variable

That doesn't check if the variable exists though, it checks if the stash for that name is populated with anything. Having a sub or file handle with the same name would cause the stash entry to exist, usually stored inside a GLOB. While the other types can be detected, it isn't possible to distinguish between an undefined and non-existent scalar by inspecting a GLOB in pure perl.

Replies are listed 'Best First'.
Re^4: detecting an undefined variable
by LanX (Cardinal) on Sep 21, 2019 at 21:20 UTC
    You are right, exists doesn't work reliably on glob-slots. :/

    I should have known better, already got bitten by it in the past.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice