in reply to Using number "0" as an input argument

An incorrect number of arguments is a very different error than an incorrectly formatted option. Report it separately.
use strict; use warnings; # More Realistic values are required for these constants. my $VALID_DATE_FORMAT = qr{\d\d/\d\d/\d\d\d\d}; my $MAX_DEVICE_NUMBER = 17; if (!@ARGV or @ARGV>2){ die "Usage:...\n"; } my ($device, $date) = @ARGV; $device =~ s/\s//g; $date //= q(); if ($device =~ m/\D/ or $device < 0 or $device > $MAX_DEVICE_NUMBER) +{ warn "Invalid device number - Must be an integer < $MAX_DEVICE_NUM +BER\n"; } if ($date and $date !~ /$VALID_DATE_FORMAT/) { warn "Invalid date - Must be mm/dd/yyyy\n"; } print "device: $device\ndate: $date\n";
Bill