in reply to Re: My, what is "my" doing here?
in thread My, what is "my" doing here?
The thing that is really flummoxing me here, Eliya, is that so do I, in a one-liner, but that’s not what I am seeing in the larger script.
perl -e 'use strict; use warnings; my $x=0; my $y=0; if ($x eq my $y) { print "meh"; }'
Use of uninitialized value $y in string eq at -e line 1.
(No message is produced, in this one-liner, if use warnings; is omitted, and of course, this is the behavior that I expect to see all the time.)
But the large Perl file compiles with no such warnings at all! And that is what is throwing me here.
I can accept the notion of the use of my being legitimate here, and I expect the warning-message to appear in every case when use warnings; is used. This is what I expected here. But, in this particular instant case, “no warning!” The end result is that a subtle bug went into a production situation, and the only way that it was found was by line-by-line eyeball inspection in which three out of four people looking at it (“Paris in the the spring” ...) saw only what they expected to see.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: My, what is "my" doing here?
by JavaFan (Canon) on Jan 27, 2012 at 13:27 UTC | |
|
Re^3: My, what is "my" doing here?
by choroba (Cardinal) on Jan 27, 2012 at 13:28 UTC |