Use getopt::long, remove unused "$dir", other bits.
Add back "$dir".
Missing $o{h} removed.