in reply to Need help with and If Else structure.

Several comments:

  1. use strict
  2. use warnings
  3. avoid wierd changes in capitalization, e.g., $pl = $Plan, $T = $Type
  4. avoid unnecessary string interpolation, e.g., "$status", "$ss"
  5. avoid unnecessary temporary variables; what's wrong with using $user?

That said, I believe your problem is that you are assigning $status to $ss, but you haven't removed the line separator from the original string with a healthy chomp. So, $status probably looks like "yes\n", which does not match "yes". The quick fix I think is to say chomp($piece) before splitting $piece.

For a better overall approach, take a step back and look at what you're doing. You've got a single username/password combination that you need to compare to a database entry. To find a match, you're running through the entire list of usernames, and even if you find a match, you continue on through the rest. You can trim some of those useless loop iterations with a last statement. Better still is to load that information into a hashtable, as they are built specifically for looking up information rapidly and efficiently.

Replies are listed 'Best First'.
Re: Re: Need help with and If Else structure.
by ACJavascript (Acolyte) on Jan 01, 2003 at 03:21 UTC
    Thanks alot both of you.. I will try your suggestions, and yea, i see where i am going wrong now... I will try it thanks alot!