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

Answer: How do I test whether a file has some contents or not?

by merlyn (Sage)
on Oct 15, 2000 at 15:09 UTC ( #36805=categorized answer: print w/replies, xml ) Need Help??

Q&A > files > How do I test whether a file has some contents or not? - Answer contributed by merlyn

Hmm, on the off chance that "contents" is not "text", and believing the description more than the title, I'd also add:
print "it's a non-empty text-ish file" if -s $file and -T $file;

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[choroba]: TITS = Try It To See :-)
[LanX]: buongiorno!
[Discipulus]: buongiorno a te!
[choroba]: LanX ciao! BTW, yesterday evening I arrived home in my new car ;-)
[Discipulus]: it seems some signal is issued but only by services
[Discipulus]: which one choroba?

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-01-17 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (153 votes). Check out past polls.