in reply to Re: printing options with elsif statement
in thread printing options with elsif statement

ok I have changed it to check whether the variable $modtyp is x,
$modtyp = 9; if ($modtyp == 9) { print " response1"; } elsif ($modtyp == 10) { print " response2\n"; } the reponses are not being typed even if the value of $modtyp can be seen to be set to a value being checked!!!

Replies are listed 'Best First'.
Re: Re: Re: printing options with elsif statement
by dash2 (Hermit) on Feb 18, 2002 at 18:20 UTC
    Well, that code snippet works... I just tried it.

    dash2@cherokee:~ > perl $modtyp = 9; if ($modtyp == 9) { print " response1"; } elsif ($modtyp == 10) { print " response2\n"; } response1dash2@cherokee:~ >
    So, as Sherlock Holmes said, once you have eliminated the impossible, whatever remains, however improbable, must be true. Check elsewhere in your code. Check you are printing newlines, cos sometimes perl doesn't print out until you hit a newline. Check you are printing to where you think you are - did you select some other filehandle? Check that $modtyp is exactly what you think it is by doing print "modtyp is '$modtyp'". Debug. Fix. Good luck.

    dave hj~