in reply to File created but blank

Your use of open() is wrong. LOGFILE and $LOGFILE are completely different things. In your case it should have been
open(LOGFILE,$LOGFILE)

Replies are listed 'Best First'.
Re^2: File created but blank
by Fletch (Bishop) on Jul 24, 2008 at 12:57 UTC

    Yes, but if open is called with just a FILEHANDLE argument it looks in the (package, not lexical) variable of the same name (in this case $LOGFILE). Not that it's not poor style and this form really should be avoided in new code, but it will work as-is (presuming a suitable use vars qw( $LOGFILE ) / our $LOGFILE or a lack of use strict, of course).

    (And the pedantic best practices based recommendation would be open( my $logfh, ">", $LOGFILE ) or die "Can't open '$LOGFILE': $!\n";. </pedant> :)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.