http://qs1969.pair.com?node_id=563874


in reply to Why would this code work under one condition and fail for the second condition?

You have two different sets of variables you're using. At the top-most scope of the file, you've declared the lexicals $givenname, $surname, and $middle_initial; these three are set by the first conditional (if ($adduserargs == 2 || $adduserargs == 3){ ... }</c), and are visible to the adduser() function.  Then you have three other lexicals with the same name that are declared and set in the second conditional (<c>elsif ($adduserargs == 0) { ... }). They are not visible to your adduser() function which ends up looking at variables with no values in them.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart