in reply to Can't get a simple log creator to work!

if (! open LOG ) {

That line is equivalent to:

if (! open LOG, '<', $main::LOG ) {

And since you didn't store a file name in $main::LOG the open will fail.

Replies are listed 'Best First'.
Re^2: Can't get a simple log creator to work!
by aquinom85 (Initiate) on Feb 23, 2010 at 05:45 UTC
    my perl book didn't say anything about that, really the filehandles section made no sense (this is the o'reilley book). how do i use $main::LOG to store a filename to it? (it would be the name of the log file in this case right?)
      Which O'reilley book?

      I suggest you start with perlintro, and perlopentut, but basically

      open my($fh), '>', '/f/o/o' or die "Can't clobber /f/o/o : $!"; print $fh "stuff\n"; ...
      or the slick version
      use autodie; open my($fh), '>' '/f/o/o'; print $fh "stuff\n"; ...