I also thought about making it in a sub, and it is certainly a good idea, but I figured out that the OP just completed chapter 5 of Ovid's book and subroutines are explained only in chapter 7.
Comment on Re^2: New to Perl: Hashes and int(rand())
I'm not sure I'd wait so long to introduce such a basic concept, but I haven't looked at Ovid's book and so I'm not familiar with its basic structure. Also, there's the little problem that I've never written a book of any kind...