문제

How can I get a perl program to print the POD contents when an incorrect argument or number of arguments are passed in?

도움이 되었습니까?

해결책 2

You can call exec("perldoc", $0); when arguments is wrong. So user will get man-like help.

다른 팁

I'd use the Pod::Usage module

The Getopt::Long module has a good example on its usage.

If it about your program, I think you have to use:

sub usage {
  print<<help
  Usage $0: description of your script
help
}

if (($#ARGV+1) != $count_args) { usage; }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top