home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5815 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.0 KB  |  50 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!robcad!calisto!ronys
  3. From: ronys@calisto.robcad.uunet (Rony Shapiro)
  4. Subject: class negation broken - OR - what am I doing wrong ?
  5. Message-ID: <1992Sep9.134920.2169@robcad.uucp>
  6. Followup-To: comp.lang.perl
  7. Sender: ronys@calisto (Rony Shapiro)
  8. Organization: Robcad Technologies ( 1980 ) Ltd, Israel
  9. Date: Wed, 9 Sep 1992 13:49:20 GMT
  10. Lines: 38
  11.  
  12. Hello,
  13.  
  14. Given a file which contains all 26 letters, one character per line, i.e.
  15. a
  16. b
  17. c
  18. .
  19. .
  20. .
  21. z
  22.  
  23. I'd expect the following perl one-liner to print all characters except 'f':
  24.  
  25.     perl -n -e 'print if /[^f]/' file
  26.  
  27. However, ALL of the characters are printed.
  28.  
  29. As a check,
  30.      perl -n -e 'print unless /[f]/' file
  31. works as expected on the same data.
  32.  
  33.  
  34. Is the problem with perl or my understanding of [^f] ?
  35.  
  36. Platform: Sparc IPC running SunOS 4.1.2
  37. Perl compiled with cc.
  38.  
  39. perl -v
  40.  
  41. This is perl, version 4.0
  42.  
  43. $RCSfile: perl.c,v $$Revision: 4.0.1.7 $$Date: 92/06/08 14:50:39 $
  44. Patch level: 35
  45.  
  46. -- 
  47.         Rony Shapiro
  48.  
  49.     ronys%robcad@uunet.uu.net OR  uunet!robcad!ronys
  50.