Programming Assignment 1 (Perl)
Problem Sets: Note: write programs using Perl
1. Use a loop structure and code a program that produces the following output (user can specify how many lines need to be printed using a command line argument):
2. Implement a program that processes an input file by changing every occurrence of an old string into a new string. (e.g., the usage is: chstr.pl file oldstring newstring, chstr.pl is your program name, file, oldstring and newstring are parameters specified by user.)
3. (Extra Credits) Given an input file, such as text.txt, write a program to perform the following two tasks: 1) it counts the number of words in the file; 2) it takes one number x as argument, and display the top x most frequency words in the file.
4. List 3 key language features of Perl and evaluate them (state both advantages and drawbacks) using short paragraphs.