home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7550 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.2 KB

  1. From: okamoto@hpcc01.corp.hp.com (Jeff Okamoto)
  2. Date: Sat, 19 Dec 1992 01:59:30 GMT
  3. Subject: Problem with study and /o on 4.035 and 4.019
  4. Message-ID: <1180034@hpcc01.corp.hp.com>
  5. Organization: An-Pan Man Headquarters
  6. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!apollo.hp.com!cupnews0.cup.hp.com!hpscit.sc.hp.com!hplextra!hpcc05!hpcc01!okamoto
  7. Newsgroups: comp.lang.perl
  8. Lines: 28
  9.  
  10. Here's a strange error that occurs in both 4.019 and 4.035, but works properly
  11. on 4.010.
  12.  
  13.     $pat = "test";
  14.  
  15.     while ( <> ) { 
  16.         study;
  17.         if ( /$pat/o ) {
  18.             print "Found pattern\n" ;
  19.         } else {
  20.             print "Didnt find\n";
  21.         }
  22.     }
  23.  
  24. If the input to this program is "test", "test" on two lines, 010 will
  25. correctly report it was found twice, but 019 and 035 will say it wasn't
  26. found on the second try.
  27.  
  28. Removing the call to study, or the /o trailer will solve the problem for
  29. both 019 and 035.  Am I just doing something stupid?  Granted, the study
  30. is pretty useless in this case, but I think the script should still work.
  31. -- 
  32.  \      oo    The New Number Who,
  33.   \____|\mm    Jeff Okamoto
  34.   //_//\ \_\    HP Corporate Computing & Services
  35.  /K-9/  \/_/    okamoto@ranma.corp.hp.com
  36. /___/_____\    
  37. -----------    (415) 857-6236
  38.