I want to set a variable in a module from one calling module and want to retrieve that value inanother calling module.
I have done something line this:
package Test;
our $data = undef;
sub set_data
{
$data = shift @_;
}
sub get_data
{
return $data
}
I am setting the data as :
package Mod1;
use Test;
Test::set_data(1);
I am retrieving the data as:
package Mod2;
use Test;
print Test::get_data();
But I am getting undef while retrieving the value.
What is wrong in my implementation?