Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: File Attributes in Win32

by c-era (Curate)
on May 01, 2001 at 18:45 UTC ( [id://76977]=note: print w/replies, xml ) Need Help??


in reply to File Attributes in Win32

When it is false the '-A $file' returns null (which is considered a string). You can use this code to correct it:
if (-A $file || 0 > 30)
The '||' will use 0 to do the compair if -A $file is null (and no more warning).

Update: I don't know why I missed this (thanks to the people below who brought it up). '-A $file' is returning false because you are getting a directory listing for a directory and then checking the files in the current directory. Use this if statement:

if (-A "$dirPath\\$file")
Then you don't even need the '|| 0'.

Replies are listed 'Best First'.
(tye)Re: File Attributes in Win32
by tye (Sage) on May 01, 2001 at 19:39 UTC

    You have a precedence error. Your code should be: if(  ( -A $file || 0 ) > 30  ) { || is a logical operator so it binds less tightly than comparison operators because you usually use it like: if(  -A $file > 30  ||  -M $file > 60  ) { and precedence is designed so that most common usages don't require parens (except for the bitwise operators which inheritted their broken precedence from C).

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-19 16:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found