Date: Fri, 28 Feb 2003 15:57:26 -0600 (CST) From: Mark Jacobson To: 810-151-01@uni.edu Subject: PERL example from today... ******** IF YOU DID NOT RECEIVE THIS EMAIL, OR ******** IF YOU WANT TO RECEIVE NOTES ELSEWHERE, ******** send me an email NOW and tell me to add you to the PERL list. jacobson@cns.uni.edu Hi 023 students, Here is the example from today's class that illustrated the ord function and the chr function. chr(65) is the letter A A speed limit on I-380 or I-80 or I-35 = 65 - ord "ABCDEF"; is 65 ord "B" is 66 ord "Z" is 90 ord "a" is 97 = 65 + 32 = ord("A") + 32 ord "z" is 122 = 90 + 32 = ord("Z") + 32 ord "0" is 48 as in 48 contiguous states in the USA, with Alaska and Hawaii being geographically separate from the other 48 states. ord "9" is 57 in honor of the steak sauce.... Heinz 57 sauce. ------------------------------------------------------------------ for (\$i = 48; \$i <= 90; \$i = \$i + 4) { print "\$i " . chr(\$i) . "\n"; } print "\n"; \$word = "Panthers"; \$word = uc \$word; @letters = split(//, \$word); foreach (@letters) { \$asciiValue = ord; # <-- ord \$_ is implied here # ------ \$alphaPosition = \$asciiValue - ord "A"; print "\$asciiValue \$alphaPosition \$_ \n"; } ------------------------------------------------------------------ Type printers at the cowboy prompt and see this: venkman@faye:~\$ printers Printers on the Cowboy Bebop cluster ----------------------------------------------------------------- Printers available: wrt339 wrt112 ----------------------------------------------------------------- Submit a print job : lpr -P ... List a print queue : lpq -P Remove a print job : lprm -P Submit a 2 columns/page job : enscript -2r -d ... ---------------------------------------------------------------- For more information on how to use a command use: man ------------------------------------------------------------------ enscript -2r -dwrt112 feb28th.handout is how I printed one the handout for today's class. Mark