I have very strange (quantum-like: looking at a variable causes it to exist with the right value!) behavior, which I am sure must be documented somewhere deep in the perl documentation.
I can't replicate it in any small program, so I will describe the behavior here.
Update: see my reply to myself, where a small program to replicate this behavior is shown
A package I have reads:
gives me: Use of uninitialized value in concatenation (.) or string at (eval 40) line 1. but if I uncomment the print line, everything works fine, and 'this string' prints out with no errors at all!... my $var ... sub initialize { ... $var = 'this string'; ... } sub mysub { # print STDERR "var = $var"; print STDERR eval("...$var..."); } BEGIN { initialize() }
It is a large, spaghetti of a program, but I have verfied that deleting the one comment character produces this result.
I know that looking at a variable can cause it to get defined, but how can a simple print cause an unitialized variable to get defined with the right value?
In reply to quantum behavior in perl? by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |