in reply to print() on closed filehandle..

open(OUT,">>$sql_file"); print OUT localtime().' ^ '.$pid.' ^ '.$_[0]."\n"; close(OUT);

That sounds like the open has failed. Did you define $sql_file variable? And you should do error checking after open:
open OUT, ">>$sql_file" or die "Can not open $sql_file";

I define variables in one bit of code then use them in another 'required' file in a rather obscure but functional way.

Sounds like bad programming practise to me. Take a look at the following node on better programming practise:

  • Perl Programming guidelines/rules

    A cleaner approach I would take is to build a hash of variables, and pass the reference to the hash to the constructor / initializer of your module -
    use strict; use warnings; use MyModule; my %vars = ( 'foo' => 'bar', 'date' => '20040203', 'name' => 'roger', ... ); my $mymodule = MyModule->new(\%vars);

    And then in your module you refer to the variables by name.

  • Replies are listed 'Best First'.
    Re: Re: print() on closed filehandle..
    by wolis (Scribe) on Feb 03, 2004 at 05:39 UTC
      Ah.. thanks guys,

      Yes, that old 'functional' bit of code I require is long overdue for a re-write - if only I can find the time (sigh)

      And I'm so sorry to have troubled you on such a trivial thing re open().. Since its a new setup I didnt have the correct folder to write into.

      I mis-interpreted the warning thinking it was saying I had my lines of code the wrong way round :-) (which logically they were if the file was not opened in the first place)

      Keep up the good work!

      ___ /\__\ "What is the world coming to?" \/__/ www.wolispace.com