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

try checking the parameters before the split

while (defined($ARGV[0])) { my $opt = shift; if($opt eq '-f') { my ($username, $domain) = split(/@/, shift); } else { die("Usage: <username\@domain>\n"); }a }