in reply to Deadlock occurring, reason unknown
In unix, this can sometimes go unnoticed because the filehandle for the next file that is opened will be the next one that is available, which may be the one that you last closed.
Here is some code that shows the idea:
This code dies with a can't print because IN is still selected. This example is repaired by adding a select STDOUT statement right before the print.use strict; open(IN, "datafile") or die "can't open datafile"; local $/= 1; select(IN); $_= <IN>; close IN or die "can't close IN"; print "datafile:\n", $_ or die "can't print";
You may want to add error checking to your code not just for your open commands, but also on your print and close statements.
It should work perfectly the first time! - toma
|
---|