Hi gustav -
  
At 2005-10-13, 23:42:22 you wrote:
>Hi!
>
>Just a quick question. Can I set or unset an enviromentvariable through
>this Hash? I just need a yes ... :-)
>If No, please give explanation...

Not really.

If you do something like:

$ENV{SOMEVAR} = 'somevalue';

SOMEVAR will be available to you in your program and any programs you spawn
( with 'system' or backtics). But after your perl script ends, SOMEVAR is lost. 
This is
because the system provides you with a new shell - with the envirnoment 
inherited
from the caller - for the duration of the script; the evironment and its 
modifications are
lost when the script ends.

On 'nix, you can play with the 'source' operator: '.', which instructs the 
shell to run the
command following the '.' operator in the same shell (I'm talking bash - not 
sure about
other shells). 
>
>/G
>http://www.varupiraten.se/
>
>
>
>> Hi!
>>
>> Thanx a LOT!!!
>>
>> /G
>> http://www.varupiraten.se/
>>
>>
>>> 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>
>>>
>>>
>>>
>>
>>
>>
>
>
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>
>-- 
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.344 / Virus Database: 267.12.0/132 - Release Date: 10/13/2005
>


                        
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