wackattack has asked for the wisdom of the Perl Monks concerning the following question:
program #2#!/usr/bin/perl use strict; $a = "hi\n"; print $a;
Why does program #2 give me an error (when I don't use "my"):#!/usr/bin/perl use strict; $i = 5; print "The value is $i.\n";
Global symbol "$i" requires explicit package name at ./test-strict.pl line 4.yet #1 doesn't? I'm very well aware that using strict requires you to declare your variables with "my". Yet I didn't use the word "my" on #1 and it worked fine.
Global symbol "$i" requires explicit package name at ./test-strict.pl line 5.
Execution of ./test-strict.pl aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Questions on strict
by davido (Cardinal) on Jan 03, 2007 at 05:49 UTC | |
|
Re: Questions on strict
by perrin (Chancellor) on Jan 03, 2007 at 05:51 UTC | |
|
Re: Questions on strict
by perl_lover (Chaplain) on Jan 03, 2007 at 05:47 UTC | |
|
Re: Questions on strict
by zentara (Cardinal) on Jan 03, 2007 at 14:05 UTC |