Loading ...
Sorry, an error occurred while loading the content.

IF and strings...

Expand Messages
  • Victor
    Hi,Im pretty new to Perl and also use it and try to learn it on three diffrent systems. You know on a webserver, on my home PC and on the work Mac. And I
    Message 1 of 1 , Apr 3 3:56 AM
    • 0 Attachment
      Hi,

      Im pretty new to Perl and also use it and try to learn it on three
      diffrent systems. You know on a webserver, on my home PC and
      on the work Mac. And I am haveing trouble, I remebered a
      program that was if I don't completly miss remember in a book
      called "C=64 Tips and Tricks" so it's old C=64 program. That has
      a discusion with you, we'll actualy ask about your name and how
      old you are and then ask if you want to play a game with it. The
      trouble is when I get to the game if thing. At the moment my
      code looks like this:

      ---CODE START---
      if($spel != /i'yes'/i or /i'no'/i ) {  #checks if $spel not equals "yes" =

      # or "no" or 'Yes" or 'No'
      print "Yes or No, not $spel"; #if $spel is not yes, no, Yes, No =

      #then it prints "Yes or No, not $spel"
      }
      if($spel != 'yes' or 'Yes') { #checks if $spel is not equal to 'yes' or
      #'Yes'
      print "You don't want to play with me so I don't want you todo
      anyting"; #if it does this text is printed
      exit 0; #then the programs exit with return value 0.
      }

      # Here comes the code if yes was answerd.
      ---CODE END---
    Your message has been successfully submitted and would be delivered to recipients shortly.