in reply to cleaning up code with "do" ?

Sounds to me like the difference is that the do'd code hasn't been compiled yet when later parts of the "main" code are compiled, and perl makes different parsing choices because not all the same symbol table entries are defined.

Try only cutting out subroutines or things you can reduce to subroutines. Then load them with BEGIN{require "filename.pl"} and call the subroutines as needed.

Alternatively, disambiguate all the places that you have problems; in the example case, try print INVOICEVIEW (translate(...)."\n").