http://qs321.pair.com?node_id=1018637


in reply to Output Repeats in the elsif statement

Were you trying to test whether $carroadnameverify2 is null in the elsif statement? If so, I think you meant this:

... elsif ($carroadnameverify2 eq '') { ...

$carroadnameverify2 =~ '' will evaluate to true, regardless of $carroadnameverify2's value or whether it's even defined.

Replies are listed 'Best First'.
Re^2: Output Repeats in the elsif statement
by PilotinControl (Pilgrim) on Feb 13, 2013 at 21:19 UTC

    changing it to "eq" causes the output to be blank not returning the Car Record Not Found...leaving it at =~ causes the Car Record Not Found to be repeated over and over for three lines of output...thats the problem

      Ah! Just use else:

      else { printf("CAR RECORD NOT FOUND"); }

      As your if tests for the record...

        changing the line to } else { did not work all it did was create this: http://65.40.136.120/~files/error.jpg which is the output I get and all i need it to say is Car Record Not Found once not multiple times