Question: 5) (10 marks) Write a Perl program named a1q5.pl and submit it using the submit-nlp command. The program reads the standard input (use the diamond


5) (10 marks) Write a Perl program named a1q5.pl and submit it using the submit-nlp command. The program reads the standard input (use the diamond operator) and at the end pro- duces basic statistics about the input in exactly the following form: number of lines: 5 shortest line length: 0 longest line length: 23 The final LF (or CRLF) characters are not considered to be part of the line, and you should also remove any trailing spaces from each line, before computing the lengths. For example, the above output would be obtained from the following file: first line 12345678901234567890123 a trailing spaces line: above line has spaces or, if we make the white-space characters visible (u for space, t for tab, and for new-line or LF): firstyline 12345678901234567890123 aytrailinguspacesuline:vtu in aboveyline_hasyspaces Hint: The Perl function length() can be used to get length of a string. 5) (10 marks) Write a Perl program named a1q5.pl and submit it using the submit-nlp command. The program reads the standard input (use the diamond operator) and at the end pro- duces basic statistics about the input in exactly the following form: number of lines: 5 shortest line length: 0 longest line length: 23 The final LF (or CRLF) characters are not considered to be part of the line, and you should also remove any trailing spaces from each line, before computing the lengths. For example, the above output would be obtained from the following file: first line 12345678901234567890123 a trailing spaces line: above line has spaces or, if we make the white-space characters visible (u for space, t for tab, and for new-line or LF): firstyline 12345678901234567890123 aytrailinguspacesuline:vtu in aboveyline_hasyspaces Hint: The Perl function length() can be used to get length of a string
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
