
Borderline
Deleted
Jan 2, 2000, 7:16 PM
Post #2 of 2
(2142 views)
|
As you are going to find during your studies of Perl TIMTOWTDI (Tere Is More Than One Way To Do It) and there always is. One way would to store the numbers into an Array like this<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> @nums = (1003118, 1005121, 1007126);</pre><HR></BLOCKQUOTE> You could populate that array in any number of ways and then just use a loop to go through the values like this<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> for $item(@nums) { if ($number == $item) { print "The code is not longer valid"; exit } }</pre><HR></BLOCKQUOTE> Or is you want to use the 'or' operator like you did and just hard code the numbers into the code<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> if (($number == 1003118) or ($number == 1005121) or ($number == 1007126)) { print "The code is not longer valid"; exit }</pre><HR></BLOCKQUOTE> The ( ) around each comparison is not nesisary in this case but it makes it more readable. As I said before I am sure you can find many ways to do these comparisons. Have Fun! Scott
|