User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 391,659 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,797 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser:
Views: 3492 | Replies: 3
Reply
Join Date: Jan 2007
Posts: 6
Reputation: mandible is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mandible mandible is offline Offline
Newbie Poster

how to read unix profile variable into Perl

  #1  
Feb 26th, 2007
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,360
Reputation: masijade is a jewel in the rough masijade is a jewel in the rough masijade is a jewel in the rough masijade is a jewel in the rough 
Rep Power: 8
Solved Threads: 117
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: how to read unix profile variable into Perl

  #2  
Feb 26th, 2007
$ENV{UNIXVAR}
Last edited by masijade : Feb 26th, 2007 at 9:22 am. Reason: formatting
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Jan 2007
Posts: 6
Reputation: mandible is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mandible mandible is offline Offline
Newbie Poster

Re: how to read unix profile variable into Perl

  #3  
Feb 26th, 2007
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.
Reply With Quote  
Join Date: Jan 2007
Posts: 6
Reputation: mandible is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mandible mandible is offline Offline
Newbie Poster

Re: how to read unix profile variable into Perl

  #4  
Feb 26th, 2007
thanks for the help I didn't notice those were braces around the variable this is exactly what I needed
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Perl Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Perl Forum

All times are GMT -4. The time now is 1:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC