Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Why would this code work under one condition and fail for the second condition?

by japhy (Canon)
on Jul 26, 2006 at 19:33 UTC ( [id://563874]=note: print w/replies, xml ) Need Help??


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
  • Comment on Re: Why would this code work under one condition and fail for the second condition?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://563874]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-25 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found