home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5572 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.1 KB

  1. Path: sparky!uunet!decwrl!bu.edu!Shiva.COM!world!dsb
  2. From: dsb@world.std.com (David Boyce)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: help with if ( ! $a =~ /##/ ) PLEASE!!!
  5. Message-ID: <Bto5Lw.63K@world.std.com>
  6. Date: 28 Aug 92 01:03:31 GMT
  7. References: <ericw.714945775@bach>
  8. Distribution: usa
  9. Organization: The World Public Access UNIX, Brookline, MA
  10. Lines: 24
  11.  
  12. In article <ericw.714945775@bach> ericw@bach.amd.com (Eric Wedaa) writes:
  13. >I am having a h!@# of a time getting this code fragment to 
  14. >work:
  15. >
  16. >if ( ! $a =~ /#/ ){
  17. >    some_random_bit_of_perl;
  18. >}
  19. >
  20. >It never does anything!  What I want it to do is if $a does not 
  21. >have "#" in it, then it should do "some_random_bit_of_perl;"
  22. >
  23. >What fundamental thing am I missing?
  24.  
  25.     Precedence rules. Put parens around the conditional:
  26.  
  27. if ( ! ($a =~ /#/)){
  28.  
  29. >Silly question of the day...  (And I know that 15 minutes
  30. >after I post this, and it goes out through the ether, I'll
  31. >probably figure it out myself.) 
  32.  
  33.     And 15 minutes after that the net will be deluged with answers.
  34. -- 
  35. David Boyce    dsb@world.std.com    617-576-1540
  36.