2018-03-01 15:00 GMT+01:00 yary <not....@gmail.com>: > Something to do in small scripts which don't aren't module material, is to > put all the "useful" code into subs, put the command-line processing & > printing into a "sub MAIN", and then have only this top-level statement: > > exit MAIN unless caller; >
This approach is called a "modulino". See those articles: https://perlmaven.com/modulino-both-script-and-module https://www.perl.com/article/107/2014/8/7/Rescue-legacy-code-with-modulinos/