Re: setting the environment variables in perl

From: Flemming Greve Skovengaard (dsl58893_at_vip.cybercity.dk)
Date: 07/27/04


Date: Tue, 27 Jul 2004 16:58:28 +0200
To: "beginners@perl.org" <beginners@perl.org>

Paul Kraus wrote:
> You can access all the env variables like this...
>
> $ENV{ 'VAR' }
>
> example
> my $home = $ENV{ 'HOME' };
> print "$home\n";
>
> I have never tried to change them but I would assume
> that it would work.
>
> HTH,
> Paul Kraus
>
> On Tue, Jul 27, 2004 at 07:29:45AM -0700, jason corbett wrote:
>
>>How does one go about assuring that the environment variables are properly set in perl? I read several books, but none go in depth about how to write a script that includes all the required variables, that way nothing gets left out.
>>
>>Please advise.
>>
>>JC
>>
>>[snipet]
>>
>>
>>#!/usr/bin/perl -w
>>
>>$ENV{"ORACLE_HOME"}="/orav101/oracle/8.1.7";
>>
>>use strict;
>>use DBI;
>>use lib '/home/samcsm/jason/myperl/lib/perl5/site_perl/';
>>
>>
>
>

Use this one-liner to check your environment variables:

perl -Mstrict -we 'foreach my $key (sort keys %ENV) { print "$key =>
$ENV{$key}\n" }'

-- 
Flemming Greve Skovengaard                    The prophecy of the holy Norns
a.k.a Greven, TuxPower                        the world is doomed to die
<dsl58893@vip.cybercity.dk>                   fire in the sky
4112.38 BogoMIPS                              the end is coming soon


Relevant Pages

  • Re: setting the environment variables in perl
    ... You can access all the env variables like this... ... Paul Kraus ... > use strict; ... > use DBI; ...
    (perl.beginners)
  • Re: ssh-agent for openSSH does not export SSH_AUTH_SOCK..
    ... > I have the problem that I cannot access the ssh-agent once started, ... It cannot "export the ENV variables;" it has no ... new subcommand into which some environment variables are exported, ... be generated) which can be evalled in the calling shell. ...
    (comp.security.ssh)
  • Re: ssh-agent for openSSH does not export SSH_AUTH_SOCK..
    ... > I have the problem that I cannot access the ssh-agent once started, ... It cannot "export the ENV variables;" it has no ... new subcommand into which some environment variables are exported, ... be generated) which can be evalled in the calling shell. ...
    (comp.security.ssh)
  • VC++ 2005 and environment variables
    ... I am using environment variables in my VC++ 2005 pocketpc ... for example i have the output directory set to ... The only 2 places env variables are not working are ie ... recognise my env variables. ...
    (microsoft.public.vc.ide_general)