It can be used by programs and other modules, and can be used outside of the example script too. For example, you can have a program (or module used for a program) that cleans every tag from HTML files, deliver it to Text::Statistics, and processes the CSV output for obtaining some other data. And "hardcode the source of the input" appears to me senseless in this context.
See modules for NLP, disambiguation, WordNet, parsing, and other linguistic stuff. Many of them work on files and generate files as output.
I beg to differ. It can't because your function sends "fim de programa" (among other things) to STDOUT, even when it's not true. Your "module" assumes the script is there to serve it, while it should be the other way around.