in reply to organizing program structure

Not only should you use subroutines, you should also, eventually, package them up into modules. See also: perlintro -> Writing subroutines