If you are using Windows this will not give the correct number of characters. You don't say which operating system, so forgive me if this is irrelevant.
Windows text file lines are terminated by two characters: "\r\n" (carriage-return and new-line). Perl hides the "\r", so your count will be -1 for each line in the file. You could just add 1 for each line, but better yet tell perl that you want to read each and every character. Use
.
(look it up) but I guess your tutors want the character count.