Reputation: 81
I am trying to do something like this: There are:
package Module;
use base 'Exporter';
our @EXPORT = qw(print);
sub print {
my $nr = shift;
print "$nr\n";
if ($nr >= 5) {
print "greater\n";
} else {
print "smaller\n";
}
}
1;
and
main.pl
:
use My::Module;
my $number = 7;
Module->print($number);
The problem is that when I run it I get this :
Module
smaller
can anyone help me figure out what I am doing wrong?
Upvotes: 1
Views: 305
Reputation: 7187
When the arrow operator is used, the thing on the left is implicitly passed as the first parameter. You want to use Module::print($number)
;
Upvotes: 1