Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Use of uninitialized value in numeric gt (>)

by YuckFoo (Abbot)
on Aug 12, 2004 at 22:54 UTC ( [id://382490]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://382490]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-20 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found