in reply to how to write a module

You just need to export the NZD function. See the Exporter.pm documentation for examples of how to do this.