Perl 'global' variables

Where can I put a global username variable so that all of my scripts during a session can access it?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

How about in a file with a name unique to the session?
if your environment contains $USER

$user = $ENV{'USER'};

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Oh, was the question meant to be "where can I find", rather than
"where can I put"?

HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Sorry if there are several ways to interprete spoken language.
I read it as:
   where in a session can I put a global variable, so that all my (perl) scripts can access them.

If myleslawrence meant:
   where can I put a perl global variable, so that all other perl scripts can access them
ozo's solution is the choice

ozo, am I right that you also don't know any other way to export environment variables in perl?
You may be right, that interpretation just didn't occur to me.
I was mainly wondering what constitutes a "session".

And yes, in perl or any other language, there's no legal way to
force another process to change its environment variables without
its cooperation.  You can set what a child is born with when you
spawn it, but you can't set your parent's environment.
> but you can't set your parent's environment.
I still know what  source  and  .  are doing, and that it is not possible with any other script, but this was the final hint.
Thanks ozo.
Instead of handing over some points, here is a quick 'n dirty solution for perl (to be improved in many ways:-)

    exec perl -e '$ENV{"your_var"}="value"; exec "/bin/csh";'

myleslawrenceAuthor Commented:
This sounds like it would work on inix but:
(if your environment contains $USER
$user = $ENV{'USER'}; )
didn't return anything on my NT server.
My specific situation is that I have many people entering data into a defect tracking database. One of the fields is submitter. I'd like to populate that field with their name but even if they 'login', I'd still have to pass the name from script to script. I'd rather just grab it from a global area. A random file name wouldn't work either because the next script wouldn't know what that file name was either. I must be missing something because I can't possibly be the first person who would want to do this
How about  $ENV{'USERNAME'}  on NT?
myleslawrenceAuthor Commented:
Nope - nothing
Hmm, sounds that your are not a NT-domain user.
Check in a cmd-window with  SET  which environment variables are set. Luckily you find one containing your username :-)
If not you have to modify your logon script to create such a variable.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.