in reply to Use of uninitialized value in numeric gt (>)

The problem is -s returns undef if the file does not exist. Then undef causes the 'uninitialized' warning. One fix for this is to set $flag_size to 0 when -s returns undef:

my $flag_size = -s 'online.flg' || 0;

YuckDef

Replies are listed 'Best First'.
Re^2: Use of uninitialized value in numeric gt (>)
by wolis (Scribe) on Aug 13, 2004 at 07:19 UTC
    Thankyou, and everyone who replied.

    I will now go and check but I recon your right. The file did not exist.

    I will check out -f as all I really want to do is know if a file exists I dont really care what size it is if it does exist.

    Ideally Id like to do this:

    my $offline = -f 'online.flg';
    ..with the hope that it will return false if the file doesn't exist (without raising a warning) - thus achieving my aim.

    Thanks Monks!

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