Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 ( #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? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2022-05-29 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?