environment variables in perl

environment variables in perl

am 18.07.2011 13:29:34 von Irfan Sayed

--0-943703692-1310988574=:50369
Content-Type: text/plain; charset=us-ascii

hi,

i am executing one shell script within perl script. now what i need is , i need to make available all the variables set by that shell script to perl script
for example

following is the shell script
build="abc"
export build
echo $build

now the value of $build i need to access in perl script


if i do in perl like this :
print "Environment is : $ENV{'build'}\n";

then it does not pint anything

can someone please suggest ??

regards
irf

--0-943703692-1310988574=:50369--

Re: environment variables in perl

am 18.07.2011 13:44:39 von Shawn H Corey

On 11-07-18 07:29 AM, Irfan Sayed wrote:
> if i do in perl like this :
> print "Environment is : $ENV{'build'}\n";
>
> then it does not pint anything
>
> can someone please suggest ??

In Windows, there is only one environment. That means if a child
process changes it, its parent can access the change.

In Linux, each process has its own environment. The child process
inherits its parent's at the time of the fork and each is independent
thereafter.

If you want two processes to communicate, you need techniques called
Inter-Process Communication (IPC). See `perldoc perlipc` for details.


--
Just my 0.00000002 million dollars worth,
Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software: Fail early & often.

Eliminate software piracy: use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: environment variables in perl

am 18.07.2011 15:24:02 von Christian Walde

On Mon, 18 Jul 2011 13:44:39 +0200, Shawn H Corey =
wrote:

> In Windows, there is only one environment. That means if a child
> process changes it, its parent can access the change.
>
> In Linux, each process has its own environment. The child process
> inherits its parent's at the time of the fork and each is independent
> thereafter.

That is most certainly not the case. On Windows %ENV behaves like it does=
on Linux:

https://gist.github.com/899a1385b703bba7f552

--=20
With regards,
Christian Walde

--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: environment variables in perl

am 18.07.2011 15:29:38 von Shawn H Corey

On 11-07-18 09:24 AM, Christian Walde wrote:
> On Mon, 18 Jul 2011 13:44:39 +0200, Shawn H Corey
> wrote:
>
>> In Windows, there is only one environment. That means if a child
>> process changes it, its parent can access the change.
>>
>> In Linux, each process has its own environment. The child process
>> inherits its parent's at the time of the fork and each is independent
>> thereafter.
>
> That is most certainly not the case. On Windows %ENV behaves like it
> does on Linux:
>
> https://gist.github.com/899a1385b703bba7f552
>

OK, that makes things easier. Use `perldoc perlipc` for both.


--
Just my 0.00000002 million dollars worth,
Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software: Fail early & often.

Eliminate software piracy: use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/