in reply to CGI.pm: $q->param can be an array. Can be a single value. How do you know which?

First, an issue of terminology. param() doesn't return an array, it returns a list. Secondly, using foreach with only one element is perfectly fine. It will simply loop once. You could use this as a generic (as chromatic mentioned) way to handle your CGI parameters, but I repeat his advice that you should probably only look for a list when you expect a list.