derekl
asked on
Module definition problem
I'm trying to define a module:
package Foo;
use strict;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(bar);
our $VERSION = "1.0";
sub bar() {
my $val = shift;
print $val;
}
1;
However when I try to use the bar function as follows:
use strict;
use lib 'E:/Programming/Perl/libs' ;
use Foo;
bar("Test");
I get the following error:
Too many arguments for Foo::bar at test.pl line 6, near ""Test")"
Execution of test.pl aborted due to compilation errors.
What's going on here?
package Foo;
use strict;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(bar);
our $VERSION = "1.0";
sub bar() {
my $val = shift;
print $val;
}
1;
However when I try to use the bar function as follows:
use strict;
use lib 'E:/Programming/Perl/libs'
use Foo;
bar("Test");
I get the following error:
Too many arguments for Foo::bar at test.pl line 6, near ""Test")"
Execution of test.pl aborted due to compilation errors.
What's going on here?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER