Hello I was wondering if there is a way to read a unix profile'd variable while inside my PERL code?

I'm trying to do something like this.

system( " execute some code >> $UNIXVAR\log");

also tried

system( " execute some code >> '$UNIXVAR\log'");

I think though that the way I'm executing my application that I'm losing my profile's exported varibles.

I'm executing my app like this
./perlapp.pl
This is on an AIX Unix environment if this helps anyone.

Recommended Answers

All 6 Replies

$ENV{UNIXVAR}

Thanks for the quick reply, but that's not quite what I need.
I wasn't quite clear enough.
So for example say I export a path to a variable name then my perl script I want to access that path that is stored in the variable is there a way to access that?

From what I see from the $ENV variable options it holds a lot of information the system and unix environment but I do not see any profile/user variables in the list.

thanks for the help I didn't notice those were braces around the variable this is exactly what I needed

Hello,

I am facing the same probelm, and i am not clear with the solution.
I wanted to read a unix PATH variable into perl script.

$path_var=`$PATH`;

Can u help me in doing this.


Thanks in advance,
Subii

$ENV{PATH}

Thanks a lot... was trying with $ENV{$PATH}..... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.