I was trying to pull some version information on java into an array and thought I could pull the string I wanted out of the array. But for some reason my script was not getting the data into the array like I thought it would.
Running:
#! /usr/local/bin/perl
use strict;
my @javaInfo = `java -version`;
foreach my $line (@javaInfo)
{
print "- $line\n";
}
Gives me an output from java -version displayed while the script runs, but the array never gets populated for some reason.
Running:
#! /usr/local/bin/perl
use strict;
my @perlInfo = `perl -version`;
foreach my $line (@perlInfo)
{
print "- $line\n";
}
Gets the perl information fine...so is this due to the way the data is returned? The format (like the quotes around the java version), maybe I am missing pipe for the data stream or something else?
Thanks