
Cupidvogel
Novice
May 6, 2012, 8:19 AM
Post #1 of 3
(1321 views)
|
|
Using "use" doesn't import variables implicitly
|
Can't Post
|
|
Hi, I was under the impression that one difference between use and require is that the former enables one to use unqualified versions of the imported variables, while the latter requires fully qualified names. But look at my situation, I am running a code from C:\Perl\Codes under test.pl which contains this:
BEGIN {unshift @INC, "C:/"}; use Cards::need; print "$w"; I have added a folder named Cards in C:\\ directory, inside which there is the module called need.pm. It contains this code:
package Cards::need; our @b; $w = 5; @b = (1,2,3); However when I run the test.pl file, nothing gets printed until I edit the 3rd line to be a fully qualified name like print $Cards::need::w. So why is the implicit import not working?
|