in reply to Odd error message at 5.8.3
I get what you would expect: the same result, but without the warning. I think the warning is telling you that perl won't violate the conventions that ikegami mentioned. You could get around this fairly easily if you simply move the close of STDIN to follow the open of STDOUT. Keep in mind, though, that by doing this, fd 0 becomes available, and you will get the same warning if the next open is not read-only.open STDIN, "<$file" or die "can't open STDIN from $file - $!\n"; my @data = <STDIN>; my $chk1 = sprintf "STDIN file num is %d", fileno(STDIN); print STDERR $chk1."\n"; close STDIN or die "error closing STDIN - $!\n"; open TMP, "<$file"; $chk1 = sprintf "TMP file num is %d", fileno(TMP); print STDERR $chk1."\n";
As ikegami said, don't mess with the STD* filehandles unless you doing an exec.
|
|---|