Hi,

Will you please explain how to pass an argument to a subfunction defined in
a perl module? This is wahat i had tried; please correct me if I am wrong.

*Main:*

use MyModule::PrintMe;

$name = "John";
my $var = MyModule::PrintMe-> new($name);


*Module:

*package MyModule::PrintMe;

use Exporter;
use strict;

sub new {
        print("$_[0]\n");
}

1;


With this program, when I execute the main, it was not printing "John";
instead it was printing "MyModule::PrintMe"

Waiting to hear from you, thanking you in anticipation.

Regards, Kelvin.

Reply via email to