Reputation: 1
#! /usr/bin/perl
print "enter the user data";
$var=<>;
print "the entered data:$var";
#! usr\bin\perl
$var=`test2.pl`;
print $var;
When executing test2.pl
it doesn't work. How can it be solved?
Upvotes: 0
Views: 83
Reputation: 5927
Use require
to execute the another program. Try this
test1.pl
print "enter the user data ";
chomp($var=<>);
print "the entered data:$var\n";
test2.pl
require "test1.pl";
print "$var\n";
Then easily access the $var
from the test1.pl
.
Upvotes: 1