here's how I used to do it before I learned getopt:
it uses grep, puts your arguments in a hash, and you can easily set defaults, and it automatically makes your "usage" string, and it automatically rejects invalid arguments. arguments are in "option=value" style to avoid ambiguity
#!/usr/bin/perl -w
# set defaults here
%args = ( width => 750,
height => 600,
invert_threshold_factor => 0.25,
invert => -1,
pscanhome => "/home/lab/pscan",
color_a => "darkcyan",
color_b => "darkred");
$options = '[' . (join '=?] [', sort keys %args) . '=?]';
$usage = "usage: $0 $options picname\n";
$name = pop || die $usage;
foreach (@ARGV) {
my ($a, $b) = split '=';
die $usage unless grep {$a eq $_} keys %args;
$args{$a} = $b;
}