Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: selcting a specific file

by toolic (Bishop)
on Oct 22, 2007 at 20:45 UTC ( [id://646573]=note: print w/replies, xml ) Need Help??


in reply to selcting a specific file

The -z filetest works for me on *nix:
use warnings; use strict; my @files = <*.txt>; for (@files) { if (-z $_) { print "File $_ is empty\n"; } else { print "File $_ is not empty\n"; } }
I have 3 files in my current directory. Only the file named "a.txt" is empty. When I run the program above, I get this output:
File a.txt is empty File b.txt is not empty File c.txt is not empty

Log In?
Username:
Password:

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

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

    No recent polls found