I want my script to print a help message when it starts with a command line option --help. Based on the Getopt::Std documentation , this user should do the trick:
use strict;
use warnings;
use 5.014;
use Getopt::Std;
sub HELP_MESSAGE {
say "HELP MESSAGE";
}
But he does not print anything. I also tried to add this, out of curiosity:
for (@ARGV) {
HELP_MESSAGE() if /--help/;
}
It really works, but it seems pretty messy. I know that using a flag -hwill be pretty simple, but I would like to have both.
source
share