[Chapter 18] 18.4 Exercise
Author: Randal Schwartz, Tom Christiansen & Larry Wall
Date: 1999-07-02T01:36:07Z

#

| Chapter 18 Converting Other Languages to Perl |

## 18.4 Exercise

See Appendix A, Exercise Answers for the answer.

1. Convert the following shell script into a Perl program:

       cat /etc/passwd |
       awk -F: '{print $1, $6}' |
       while read user home
       do
         newsrc="$home/.newsrc"
         if [ -r $newsrc ]
         then
           if grep -s '^comp\.lang\.perl\.announce:' $newsrc
           then
             echo -n "$user is a good person, ";
             echo "and reads comp.lang.perl.announce!"
           fi
         fi
       done

18.3 Converting Shell Programs to Perl |  | 19. CGI Programming