#main.pl use strict; use warnings; my $s = { Local_IP=>"127.0.0.1", Local_Port => 5060 }; #passing the variable $s to the module p P::sss($s); #package package P; use strict; my $s1; sub sss { $s1= shift; print $s1->{Local_IP}, "\n";#it works fine } #out of sub routine it is not accesssible. print $s1->{Local_Port}, "\n";#it doesn't work 1; #### 127.0.0.1 5060 #### $Config = Config::Tiny->read( 'imp1.txt' );