in reply to Boundary conditions with Getopt::Std

how do you test for "no command line options specified" if each key in %option equals 1 by default?

They only equal 1 if the option is specified. For those options that take a value, you either get 1 or the value specified on the command line.

Another related question: I'm trying to say "if you use this option, it needs to accompany another option",
unless ($option{f} && $option{h}) { die "If you use -f, you must also use -h, and vice versa."; }

Assuming I understand you correctly. Or if you wanted the relation to be one-way (i.e., -f needs to accompany -h, but -h doesn't need to accompany -f) then you could do something like this:

if ($option{f} && !$option{h}) { die "If you use -f, you must also use -h"; } if ($option{h}) { ... }