In follow-up to that. I'd recommend keeping any use and require statements at the top of the script. It allows the next guy who needs to maintain your script an easy view of which modules it is using all in one group instead of having to search on the use and require commands to find them dispersed throughout the different subroutines.