1. Insert separating commas in a large integer number, so that "1000000" becomes 1,000,000 and "10000" becomes 10,000. To do this efficiently, search and replace several times by means of a while loop, making use of the fact that a substitution instruction returns a true value if a substitution actually took place. 2. The /etc/passwd file has a single line per user. Each line consists of 7 colon-delimited fields: loginname:password:userid(UID):groupid(GID):username:directory:shell Copy /etc/passwd into your home directory with a suitable name. (a) Write a program that reads each line from your password file. Use the split function to split the scalar containing a password entry into an array with 7 entries. (b) Create an array, each of whose elements is a reference to an array consisting of the 7 fields from a password entry. After the array is fully loaded, print the entries from this array that corresponds to YOUR login name and root. (c) Make a copy of the program in part (b). Modify the copy to use hashes, instead of arrays, for the password records (lines). You should generate an array of hashes. Consider using the field names (See at beginning of exercise) as the keys. Create a function that will return a list of the keywords. (d) Make a copy of the program in part (c). Modify the copy to use a hash, instead of an array to hold the records (lines). You should generate a two-dimensional hash. The loginname makes a good key for this hash. Create a print function that takes a single argument (a loginname) and prints the loginname followed by the key/value pairs from the corresponding record (line). 3. Discuss the differences among the following: (a) system ("ls") (b) exec ("ls" ) (c) `ls` 4. Write a script that formats the paragraphs of all files specified in the command line in a left-justified manner. The line length is to be a maximum of 40 characters; indentation is not required. Read the entire input stream into a string, replace all newlines not followed by newlines with empty strings, and feed the result to Text::Wrap::wrap 5. Write a script to output the days of the current calendar week in the format: Mon Tue Wed Thu Fri Sat Sun 21 22 23 24 25 26 27 Use Date::Manip to find the date of last Monday (if today is Monday, use today's date) and walk step by step seven days into the future. 6. Between February 1st and March 15, 2000, you want to read a 400 page book. Write a script called pages.pl that, if called at an arbitrary day of this interval, shows how much time has elapsed and which page you should accordingly have reached in your reading. On February 1st, the output should read: 0.0% of time - page 0 On March 15th it should read: 100.0% of time - page 400 Make use of Date::Manip to calculate the number of days between start date and current date and between start date and end date to determine percentages and ratios. 7. Write a CGI Script to implement a very simple "guestbook"-like feature that allows users to post one-line comments to a Web page. Keep track of all past postings (as a file). You can assume the existence of an HTML form with two elements:a text field called mail for the E-mail address of the poster, and a text field called comment for comments by the poster. Indicate the URL to run your script.