Hi guys and thanks,
I've tried your suggestions and still have the problem. Am now using use strict; use warnings; $!=1;
The return codes with $? >> 8, $? & 127 and $? & 128 are always 0.
I get error messages running date via backticks and open(), which seems to indicate that there is no result from the command. (See below).
BUT - if I reduce the array size then all runs OK!
Reducing the array to about 5881 x 2562 then my demo script runs OK.
2562 is not 100% repeatable - seems to depend on what other programs are running.
Also - it isn't symmetrical. This means that 5881 x 2562 may work, but then 2562 x 5881 doesn't.
Further suggestions welcomed.
Cheers, Peter
Bad results snippet: #Finished setup of two arrays 5761 x 2801
#After - using system("date");: #exited with value ($? >> 8) = 0
# #signal number ($? & 127) = 0
# #dumped core ($? & 128) = 0
Use of uninitialized value $cmd in print at ./xpt3.pl line 67.
#After - using backticks: readline() on closed filehandle CMD at ./xpt
+3.pl line 71.
Use of uninitialized value $result in concatenation (.) or string at .
+/xpt3.pl line 72.
#After - using open:
#End
Good results snippet: #Finished setup of two arrays 5761 x 2001
#After - using system("date");: Wed Feb 17 13:13:24 GMT 2010
#exited with value ($? >> 8) = 0
# Wed Feb 17 13:13:24 GMT 2010
#signal number ($? & 127) = 0
# Wed Feb 17 13:13:24 GMT 2010
#dumped core ($? & 128) = 0
#After - using backticks: Wed Feb 17 13:13:24 GMT 2010
#After - using open: Wed Feb 17 13:13:24 GMT 2010
#End
Code snippet: print "#Finished setup of two arrays $i x $j\n";
#Using system()
print '#After - using system("date");: ';
system("date");
if ( $? == -1 ) { print " #command failed: $!\n"; }
else { print " #exited with value (\$? >> 8) = ",($? >> 8),"\n"; }
print "# ";
system("date");
if ( $? == -1 ) { print " #command failed: $!\n"; }
else { print " #signal number (\$? & 127) = ",($? & 127),"\n"; }
print "# ";
system("date");
if ( $? == -1 ) { print " #command failed: $!\n"; }
else { print " #dumped core (\$? & 128) = ",($? & 128),"\n"; }
#Using backticks
$cmd = `date 2>&1`;
print "#After - using backticks: ",$cmd;
#Using open()
open(CMD, "date 2>&1 |");
$result = <CMD>;
print "#After - using open: $result\n";
close(CMD);
print "\n#End\n";
exit;
|