home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7766 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.2 KB

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