in reply to Can't figure out the realtive ordering.

You really need to ...

use strict ; use warnings ;

... at the top of your script, and then fix the errors that come up. This will take you on a wonderful journey and go a long way toward solving your problem.