package Common; { my $username,$sessionid; } ### #set their values in the main code $comm=new Common; $comm->$username=user; $comm->$sessionid=1234; subone($comm); #in subroutines i could call subone { print "$comm->$username"; }