System variables in Perl

Hi I'm new to Perl and the forum. I've done a quick search on my question but I didn't see an answer. I sincerely apologize if this question has been asked.

I'm trying to have my perl scrip recognize system variable $USER such that:

my $test_path = "/temp/\$USER/g03/Gau-11097.EIn";
open (TEST, "<$test_path") || die

where $USER is my username on the unix server. Right now my script is treating $USER like a string. Is there anyway for it to recognize $USER as a system variable?

Thank you very much!

The hash %ENV contains your current environment.

You can step through each one by doing:

#!/usr/bin/perl
foreach $key (sort keys %ENV) {
print "$key: $ENV{$key} \n";
}

Or access a single element by doing something like:

print "$ENV{'USER'}\n";

HTH

it works! Thanks a bunch!!