in reply to Re^2: Check for variable without leaving a trace
in thread Check for variable without leaving a trace

hm, now I get it.
but I think not even perl can tell that ( $h was used and %h was not, for example)
  • Comment on Re^3: Check for variable without leaving a trace

Replies are listed 'Best First'.
Re^4: Check for variable without leaving a trace
by educated_foo (Vicar) on Dec 09, 2009 at 16:34 UTC
    It mostly can (or at least could before 5.11), using defined:
    main @> $test = 1 1 main @> defined $test 1 main @> defined %test '' main @> %test2 = 1,2 1 2 main @> defined $test2 '' main @> defined %test2 1 main @> %test3 = () undef main @> defined %test3 '' main @> defined $test3 ''
    It doesn't detect an empty hash, but that's good enough for me.
      no, I meant, perl can tell if $a or %a is defined but given 'a' it can't say which one was used.