develooper Front page | perl.beginners | Postings from April 2012

ENV variable or others things

Thread Next
From:
Zapp
Date:
April 27, 2012 00:07
Subject:
ENV variable or others things
Message ID:
4F9A458A.3010301@Gmail.com
when I use bash, I can write a file ( a.sh ) like :
abc='abc'
ddd='aaa'
...
then I can load it in other file:
source a.sh
echo $abc $ddd # it always work!

but in perl , how can I do like that ?

I write a file ( my_env.pl ) like:
#!/usr/bin/perl -w
my $abc='abc';
my $ddd="ddd";

and in my.pl :
#!/usr/bin/perl -w
use strict;

do './my_env.pl' or die '$!\n";
print $abc $ddd; # and nothing happen

why? anybody knows? Thanks!

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About