Perl Exercises 1 ---------------- Write Perl one-liners for the following. If the "1-line" is getting too long, put the code into a script file. These exercises mostly use regexps to process text input. 1. Write a regular expression to match: a) Any valid C identifier b) Any valid C hexadecimal constant c) Any valid C floating point constant 2. From a floating point number in the form "+/- iii.dddd" it is desired to extract the integer and decimal portions and store them in two variables $i and $d. Write 3 different snippets of Perl code to achieve this. 3. From the output of "ls -l" a) calculate the total size of files whose names start with p (or any other letter). b) print the names of files whose size is an odd number of bytes. c) count the number of files whose name starts with a capital letter 4. Print the entries in /etc/passwd that have *no* fullname 5. Count the number of entries in /etc/passwd that have *no* fullname 6. Print all non-empty lines of a file 7. Count the number of comment lines in a C file. A comment line contains only " // .... " (note that there may be leading whitespace). * * * * *