hi guys, i have a problem in perl. I want to access variables from a different script.
i give an example script
first script
Code:
#!/usr/bin/perl -w
use strict;
print "enter username\n";
$name = <STDIN>;
$ENV{a}="$name";
system("/perlfiles/receive.pl");
second script
Code:
#!/usr/bin/perl
print "$ENV{a}\n";
the error shows is
Code:
Global symbol "$name" requires explicit package name at ./sending.pl line 5.
Global symbol "$name" requires explicit package name at ./sending.pl line 16.
Execution of ./sending.pl aborted due to compilation errors.
but if i try this, it works
first script
Code:
#!/usr/bin/perl
$ENV{a}="20";
system("perl called.pl");
second script
Code:
#!/usr/bin/perl
print "$ENV{a}\n";
pls help. i need to access variables from another script