in reply to Debug basic calculator syntax

The comparison operator is not '=' but 'eq' if you want to compare strings. If you change them, the program works.

Update: If you would have activated "warnings" Perl would have told you 'Found = in conditional, should be == at line 19.' which is helpful but misleading as you really should use 'eq' for string comparison.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^2: Debug basic calculator syntax
by thor (Priest) on Jun 23, 2005 at 21:19 UTC
    Ah...but the second run after changing '=' to '==' will give this error: 'Argument "foo" isn't numeric in numeric eq (==) at line <script name> <line number>'. It's the old theory of debugging; fix exactly one error at a time, because each error that you fix could be either creating or masking other errors.

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

      Well observed! That's why I said the warning message was helpful but misleading.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law