Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: checking if file is empty or not

by lolindrath (Scribe)
on Aug 07, 2000 at 16:03 UTC ( #26532=note: print w/replies, xml ) Need Help??


in reply to checking if file is empty or not

hmm, this works but is probably inefficient.
open FILE, "Filename" || die; @file = <FILE>; close FILE; $file = join( "", @file); if ( $file ne "" ) { #there's something there! }

Just thought I'd pose another solution

--=Lolindrath=--

Replies are listed 'Best First'.
Re: (Buzzcutbuddha: Don't Reinvent The Wheel!): Re: checking if file is empty or not
by buzzcutbuddha (Chaplain) on Aug 07, 2000 at 18:57 UTC
    There are file operators out there that will test the size and/or if it's an empty file already created, and there is no need to create a new way to do it.
    It's good to know that you are thinking, and I am happy that you are willing to participate, but there is a reason why laziness is a virtue. :)

    Cheers!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://26532]
help
Chatterbox?
[pryrt]: Is there a way to search for/list "nodes I've voted on"? (I thought there was, but cannot find it now)
[choroba]: Your votes in your profile?

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-03-29 13:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (351 votes). Check out past polls.