944,198 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 8476
  • Perl RSS
Feb 26th, 2007
0

how to read unix profile variable into Perl

Expand Post »
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.

[code]
system( " execute some code >> $UNIXVAR\log");
also tried
system( " execute some code >> '$UNIXVAR\log'");
[\code]
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mandible is offline Offline
7 posts
since Jan 2007
Feb 26th, 2007
0

Re: how to read unix profile variable into Perl

Perl Syntax (Toggle Plain Text)
  1. $ENV{UNIXVAR}
Last edited by masijade; Feb 26th, 2007 at 10:22 am. Reason: formatting
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Feb 26th, 2007
0

Re: how to read unix profile variable into Perl

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mandible is offline Offline
7 posts
since Jan 2007
Feb 26th, 2007
0

Re: how to read unix profile variable into Perl

thanks for the help I didn't notice those were braces around the variable this is exactly what I needed
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mandible is offline Offline
7 posts
since Jan 2007
Jul 30th, 2009
0

Re: how to read unix profile variable into Perl

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
subii P is offline Offline
3 posts
since Jul 2009
Jul 30th, 2009
0

Re: how to read unix profile variable into Perl

Perl Syntax (Toggle Plain Text)
  1. $ENV{PATH}
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Jul 30th, 2009
0

Re: how to read unix profile variable into Perl

Thanks a lot... was trying with $ENV{$PATH}.....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
subii P is offline Offline
3 posts
since Jul 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: wanted to read a unix PATH variable into perl script
Next Thread in Perl Forum Timeline: Perl Script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC