in reply to print() on closed filehandle OUT at B.p line 19, <SH> line 1732.

Change open OUT to this

open(OUT, "/tmp/$sh".".sysedge.sh") or die "Can't open /tmp/$sh.sysedg +e.sh: $!\n";
and perl will tell you

Update: kudos to wjc75019 for spotting his error without my help;-) But the or die is still good advice

  • Comment on Re: print() on closed filehandle OUT at B.p line 19, <SH> line 1732.
  • Download Code

Replies are listed 'Best First'.
Re^2: print() on closed filehandle OUT at B.p line 19, <SH> line 1732.
by wcj75019 (Acolyte) on Feb 24, 2008 at 03:53 UTC
    Duhhh...Thanks! I forgot to put in >
Re^2: print() on closed filehandle OUT at B.p line 19, <SH> line 1732.
by lidden (Curate) on Feb 24, 2008 at 17:03 UTC
    Nitpick:

    Those die statements works "better" without an explicit newline.

    my $file = '/nowhere/to/be/seen'; open my $fh1, $file or warn "$file: $!\n"; open my $fh2, $file or warn "$file: $!";
      No way! There are error messages intended for developers, and there are error messages intended for users. IO errors are clearly the latter, and line numbers are meaningless to the user. If you need the line number to make this error message meaningful, you have a bad error message.
        Good point++

        But when I write code either STDERR goes to /var/log/apache/error_log or I am the user. YMMV.