perlquestion
DizietSma
<p>
I'm following <a href="http://www.perlmonks.org/?node_id=619554">http://www.perlmonks.org/?node_id=619554</a>
but can't get it to work when <code>use strict;</code> is in place.
Could any of the masters here please enlighten this confused initiate?
The errors Perl is reporting are
<pre>
Global symbol "$testVal" requires explicit package name at ./test.pl line 8.
Global symbol "@testArray" requires explicit package name at ./test.pl line 10.
Global symbol "@testArray" requires explicit package name at ./test.pl line 12.
Global symbol "@testArray" requires explicit package name at ./test.pl line 12.
Execution of ./test.pl aborted due to compilation errors.
</pre>
My code is
</p>
<p>test.pl
<code>
#!/usr/bin/perl -T
use warnings;
use strict;
require "./shared.pl";
print $testVal;
for my $i (0 .. (scalar(@testArray)-1))
{
print $testArray[$i][0] . " = " . $testArray[$i][1] . "\n";
};
</code></p>
<p>shared.pl<code>
use base qw (Exporter);
our @EXPORT = qw(testVal testArray);
my $testVal = "hello world\n";
my @testArray = (
["Shadow", "Blinky"],
["Speedy", "Pinky"],
["Bashful", "Inky"],
["Pokey", "Clyde"]
);
1;
</code></p>