Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of bash export in Perl?

Tags:

bash

export

perl

I am converting a bash script to Perl. I am not sure what the equivalent of an export is.

LOC=/tmp/1/
export LOC

For example, for the above two lines, what would be the equivalent Perl code?

my $LOC = '/tmp/1/';
# what should go here?
like image 403
Lazer Avatar asked Dec 16 '22 09:12

Lazer


1 Answers

$ENV{LOC} = "/tmp/1";

The contents of %ENV are propagated to the environment of the child processes of a Perl script.

like image 192
mob Avatar answered Dec 28 '22 08:12

mob