If I use this to count characters in a text file in windows I get a different result from using the same code on linux. It seems to be something to do with carriage returns but I'm not sure. I would like to get the same result for both platforms without altering the file content. Can anyone help please?open(FILE, "$file"); @lines = <FILE>; $count=(); foreach $line (@lines){ $count+=length($line); } print "\n$count";
In reply to char count windows vs linux by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |