in reply to detecting an undefined variable

Could you please give us more context what you're trying to achieve?

This smells like an XY problem ...

Since - like haukex already explained - hard coded variables must already be declared at compilation time under strict, there are not many possible use cases...

Do you use strict, eval , my or our ?

Most likely you just need to check a hash key $opt{scale} for existences with exists ...

update

... or just definedness

my $myscale = $opt{scale} // 1;

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