Thanks for the suggestion. I see your point about making a sub-routine.
I go back and forth on the idea of sub-routines: sometimes I can't get enough of them (e.g., that
line). Other times, especially when I return to a program many months later and confuse myself with overuse of sub-routines, I decide to be more conservative. For instance, for CGI scripts I try to use only sub-routines (calling them from a library) to get data or to process it. I leave the printing of data in the program, not the library. I guess I could do a compromise and use sub-routines for printing, but leave them in the program, at the bottom. I just find that a program with only a list bunch of home-made functions can become confusing later when I need to modify the program.