Don't hand code a usage function. You can use
Getopt::Long and
Pod::Usage and you not only have a usage function, you also have functional documentation. The recommended usage in
Pod::Usage is excellent. There are a lot of roads to Rome here, but the way I like to do it is shown
here.