in reply to Re^11: Using a sting with a variable name
in thread Using a sting with a variable name

I don't really get your remark about use strict;.

use strict 'vars'; let's the programmer know that a variable they used doesn't exist. The programmer uses the pragma because they wish to know that (i.e. they care to know that).

Therefore, it's a counterexample to your claims that existence doesn't matter except "in the few edge cases where you can poke into the underlaying implementation" is false.

And do get your capitalization right when it matters.

I did. perl "compiles and runs: print $foo;", not "Perl (language!)".

Replies are listed 'Best First'.
Re^13: Using a sting with a variable name
by JavaFan (Canon) on May 11, 2009 at 20:23 UTC
    use strict 'vars'; let's the programmer know that a variable they used doesn't exist.
    Could you first define what you mean by exists in this context? Because:
    package main; use strict 'vars'; say $var; # Error, ($var doesn't "exist"?)
    package main; use strict 'vars'; say $::var; # No error ($::var does "exist"?)
    But that's clearly nonsense as in both snippets, $var and $::var are the same, and a variable cannot both exist and not exist.

      Could you first define what you mean by exists in this context?

      You're asking the wrong person. I'm trying to satisfy the OP, and like I said before, his question was a bit vague. Perhaps he would like to know if there's exists a given variable in the program. (That can be determined by peeking at the symtab, with the caveat I previously mentioned.)