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.
In reply to Questions on strict by wackattack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |