Hi Gustav -
  
At 2005-10-13, 23:13:33 you wrote:
>Hi there!
>
>I'd like to get a list of enviromentvariables from the *NIX-system.
>
>I'd like it in the format...
>ENV1=x1
>ENv2=x2
>ENV3=x3
>
>and so on...
>
>I think I have to use ENV-command. (http://perldoc.perl.org/Env.html)  Is
>that right? I don't understand how I get this kind of listing. Please put
>me in right direction..
>
>
>I tried to use print ENV% but I get this kind of output:
>HOSTfriggAUDIODEV/tmp/SUNWut/dev/utaudio/8dtstart_sessionlogfile/dev/nullDTSCREENSAVERLISTStartDtscreenBlankXMBINDDIR/usr/dt/lib/bindingsUTAUDIODEV/tmp/SUNWut/dev/utaudio/8AB_CARDCATALOG/usr/dt/share/answerbooks/C/ab_cardcatalogLC_ALLCDTLOGINDISPLAYCLASSSunRayOSTY
>
>I envy you how can solve this... :-)
>

You're almost there. %ENV is a hash, do you can do something like this:

print "$_=$ENV{$_}\n" for sort keys %ENV;

Or, with more keystrokes:

for my $var( sort keys %ENV ) {
  print "$var=$ENV{$var}\n";
}

Read up on hashes && good luck.
>/G
                        
Aloha => Beau;
[EMAIL PROTECTED]
2005-10-13



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to