Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Getting file size

by MZSanford (Curate)
on Sep 24, 2002 at 21:30 UTC ( #200496=note: print w/ replies, xml ) Need Help??


in reply to Getting file size

<sarcasim>

open(F,$filename) || die "Could not open file '$filename' : $!\n"; while (<F>) { $size += length($_); } close(F);
</sarcasim>
from the frivolous to the serious


Comment on Re: Getting file size
Download Code
DO NOT REALLY USE
by Anonymous Monk on Sep 24, 2002 at 23:21 UTC
    open(F, "> $filename") or die "Could not open file '$filename': $!\n"; close(F); $size = 0;
Re: Re: Getting file size
by grantm (Parson) on Sep 25, 2002 at 09:00 UTC

    I'll see your sarcasm and raise you one dose of pedantry :-)

    On Win32, your code would not work reliably unless you add binmode(F) since every CRLF pair will get converted to the single character LF.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2015-07-07 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls