I have a perl file which in turn calls another perl file. I am expecting output from second perl file. How would I get the output ? Here is what my sample code looks like.
datetimetest.pl
!/usr/bin/perl
use DateTime;
print DateTime->now()->strftime("%a, %d %b %Y %H:%M:%S %z");
print "\n";
my @perloutput = `/usr/bin/perl knowusername.pl`;
print "output:$perloutput[0]\n";
print "output 2: $perloutput[1]\n";
print "output 3: $perloutput[2]\n";
knowusername.pl
#!/usr/bin/perl
print $ENV{"LOGNAME"}."\n";
print "secondoutput\n";
print "thirdoutput\n";
I have edited answer above.