habit_forming has asked for the wisdom of the Perl Monks concerning the following question:
Give this error:#!/usr/bin/perl use warnings; use strict; package Foo; our $bar = 16; my $foo = 15; package main; our $bar = "bar\n"; my $foo = "foo\n"; print "bar = $bar\n" print "foo = $foo\n"
They _should_ be in completely different scopes... shouldn't they??"my" variable $foo masks earlier declaration in same scope at ./b.pl l +ine 13. syntax error at ./b.pl line 16, near "print" Execution of ./b.pl aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: packages within the same file.
by chromatic (Archbishop) on Aug 01, 2003 at 18:16 UTC | |
|
Re: packages within the same file.
by derby (Abbot) on Aug 01, 2003 at 17:58 UTC | |
|
Re: packages within the same file.
by bobn (Chaplain) on Aug 01, 2003 at 19:11 UTC | |
|
Re: packages within the same file.
by smalhotra (Scribe) on Aug 01, 2003 at 18:29 UTC | |
|
Re: packages within the same file.
by simonm (Vicar) on Aug 01, 2003 at 18:28 UTC | |
|
Re: packages within the same file.
by skyknight (Hermit) on Aug 01, 2003 at 19:00 UTC |