in reply to warning about prototypes too early?

Insert a declaration for the sub somewhere before you call it. You can leave the definition of the sub where it is. A declaration in perl is like sub myfoo ($$);.