I suggest reading 'perldoc perlopentut', 'perldoc -f grep' and 'perldoc -f tr'. Of course 'perldoc perlrun' might give some clues as to how you might avoid reading 'perldoc perlopentut' (as it's rather long and dull) and simply writing this whole thing as a one-liner from the command line.