Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: char count windows vs linux

by ph0enix (Friar)
on Dec 17, 2002 at 17:06 UTC ( [id://220581]=note: print w/replies, xml ) Need Help??


in reply to char count windows vs linux

Try following code

open(FILE, "$file"); $line; { local $/; $line = <FILE>; } @lines = split(/\015?\012/, $line); $count=(); foreach $line (@lines){ $count+=length($line); } print "\n$count";

Now you should obtain the same values on both systems. I think that the problem is with line endings. Is the crlf counted as one character?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-29 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found