in reply to Ensuring the correct number of arguments, assigning them or printing usage

posted this on the wrong one at first. oops

If I were you, I wouldn't confuse my lusers with the dollar signs in front of the fields in usage. They don't need to see perl to use your program. My mom (mom test is one of the more powerful tools I have) would be typing a dollar sign in front of the arguments.

Also, you don't need the scalar() in there, perl knows the left side of a == is scalar. Also, die puts extra junk on the print that might confuse people, try this:

sub usage { die "USAGE: $0 filename directory\nHalting execution"; } ## that produces: # USAGE: prog.pl filename directory # Halting execution at prog.pl line 4

...which I always felt was a little friendlier.

--
$you = new YOU;
honk() if $you->love(perl)

  • Comment on Re: Ensuring the correct number of arguments, assigning them or printnig usage
  • Download Code