I am writing a Perl script that is run by a user and makes use of the current Linux environment as variables and other variables as well. The environment settings may change and
The environment variables are accessible from anywhere in the global %ENV
hash:
print $ENV{HOME};
If you are creating objects, they probably have some attributes (being the objects hashes, arrays or even inside out objects...) Just store the relevant values into the attributes, e.g.
my $obj = Some::Package->new( name => 'Homer',
surname => 'Simpson',
city => 'Springfield',
# ... 7 more
);