Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: char count windows vs linux

by ph0enix (Friar)
on Dec 17, 2002 at 17:06 UTC ( #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? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2023-05-28 16:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?