Zarabozo has asked for the wisdom of the Perl Monks concerning the following question:
package one; use strict; use warnings; my $var = 1; package two; use strict; use warnings; my $var = 5; package main; use strict; use warnings; print "$var\n";Which gives the following warning an answer:
"my" variable $var masks earlier declaration in same scope at test.pl line 9. 51) Shouldn't the "package" mean a different scope and NOT produce the 'mask earlier declaration' warning?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is this a bug in Perl scope?
by Corion (Patriarch) on Jul 22, 2012 at 13:35 UTC | |
by Zarabozo (Sexton) on Jul 22, 2012 at 13:53 UTC | |
by Corion (Patriarch) on Jul 22, 2012 at 14:05 UTC | |
by tobyink (Canon) on Jul 22, 2012 at 19:15 UTC | |
by AnomalousMonk (Archbishop) on Jul 22, 2012 at 22:59 UTC | |
by ww (Archbishop) on Jul 23, 2012 at 00:57 UTC | |
|
Re: Is this a bug in Perl scope?
by trwww (Priest) on Jul 23, 2012 at 21:29 UTC |