I need to open a txt file and output statistics to another file. The program must be able to:
ask for a filename
check file to see if its ms-dos file format
filename should be no longer than 8 characters and should begin with an _underscore or letter and should end with .txt not case sensitive
if not then it should add .txt
program should check whether file exists and not empty
should read the file by character and get the following statistics:
character count including whitespace the punctuation. number of words. paragraphs. lines and sentences.
output details to a separate .txt file.
I don’t have much so far as I have a headache from the what I’ve done so far. Yes, I’m not very good with perl.
$pattern=”.txt”;
print (“enter filename: “);
$filename=<STDIN>;
if ($filename=~m/^a-zA-Z{1}\_{1}$pattern$/i)
Also I understand that i'll open the file with the following:
open (READFILE, $filename)|| die "error message";
AND THATS IT!!!!
I’m not looking for someone to to do the whole thing for me but more nudge me in the right direction with the structure. Please please please
In reply to Statistics from a txtfile by mbdc566021
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |