in reply to Should Modules Do I/O?

Do both. You never know what someone might want to do with the intermediate data, so leave the option of returning a hashref in there.

However if you know most of the time the data will be written to a file go ahead and do it. Users of your module should test with it before using it on real data anyway. If they don't is that your fault?