in reply to Validating command-line _parameters_ (not options)

If @ARGV is empty, then your call to shift gives you nothing: you then use nothing as an argument to split, which (quite justifiably) complains about the uninitialized value you just fed it.

To get around this, you could use an intermediate variable, thusly:

my $addr = shift; unless ($addr) {die $USAGE} my ($username, $domain) = split /\@/, $addr;
alternatively, you could simply put in an early check to see if you have the correct number of arguments:
die $USAGE unless @ARGV == 3; #or however many args you want

On the whole, I favor the first approach, as it lets you do a little more validation on the arguments (I sometimes just use my ($foo,$bar,$baz) = @ARGV myself), but if you're otherwise satisfied with your validation, the second method is an easy patch.

Update: fixed foolish typo (thanks, chipmunk!).



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders