home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / t / op / ord.t < prev    next >
Text File  |  2000-02-19  |  489b  |  24 lines

  1. #!./perl
  2.  
  3. print "1..5\n";
  4.  
  5. # compile time evaluation
  6.  
  7. # 65    ASCII
  8. # 193    EBCDIC
  9. if (ord('A') == 65 || ord('A') == 193) {print "ok 1\n";} else {print "not ok 1\n";}
  10.  
  11. print "not " unless ord(chr(500)) == 500;
  12. print "ok 2\n";
  13.  
  14. # run time evaluation
  15.  
  16. $x = 'ABC';
  17. if (ord($x) == 65 || ord($x) == 193) {print "ok 3\n";} else {print "not ok 3\n";}
  18.  
  19. if (chr 65 eq 'A' || chr 193 eq 'A') {print "ok 4\n";} else {print "not ok 4\n";}
  20.  
  21. $x = 500;
  22. print "not " unless ord(chr($x)) == $x;
  23. print "ok 5\n";
  24.