learning perl exercise chatper 7