DizietSma has asked for the wisdom of the Perl Monks concerning the following question:
I'm following http://www.perlmonks.org/?node_id=619554 but can't get it to work when use strict; is in place. Could any of the masters here please enlighten this confused initiate? The errors Perl is reporting are
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.My code is
test.pl
#!/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"; };
shared.pl
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;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: require "shared.pl" with use strict;
by choroba (Cardinal) on Feb 19, 2015 at 16:53 UTC | |
by DizietSma (Initiate) on Feb 19, 2015 at 17:05 UTC | |
by choroba (Cardinal) on Feb 19, 2015 at 17:27 UTC | |
Re: require "shared.pl" with use strict;
by vinoth.ree (Monsignor) on Feb 19, 2015 at 17:45 UTC | |
by 5plit_func (Beadle) on Feb 20, 2015 at 01:23 UTC |
Back to
Seekers of Perl Wisdom