home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7542 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.5 KB  |  45 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
  3. From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: Help on string match!
  5. Message-ID: <mcook.724724305@fendahl.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: fendahl.dev.cdx.mot.com
  8. Organization: Motorola Codex, Canton, Massachusetts
  9. References: <lj4fcsINN1lu@exodus.Eng.Sun.COM>
  10. Distribution: na
  11. Date: Sat, 19 Dec 1992 00:18:25 GMT
  12. Lines: 31
  13.  
  14. tesh@cleo.Eng.Sun.COM (Teshager Tesfaye) writes:
  15.  
  16. [...]
  17.  
  18. >    foreach $a_name ( @A_array ) {
  19. >        for(;;) {
  20.  
  21. >            if( $_ =~ "^ +[JKD]FF" ) {
  22. >                local($macname,$fname_net,$other) = split(' ',$_,3);
  23.  
  24. >  ------->    if ( $a_name eq $flop_name ) {
  25.  
  26. [...]
  27.  
  28. >I am having with the string match on the line that I show. Although I know
  29. >that $a_name and $flop_name are identical strings this string match "ALWAYS"
  30. >fails. Am I doing something wrong? Is there a better way to go about this
  31. >problem.
  32.  
  33. If you've taken logical steps and reached an illogical conclusion, then one of
  34. your assumptions must have been invalid.
  35.  
  36. How is it that you know that $a_name and $flop_name are identical?  How is it
  37. that you know that the comparison is being made?  ...that the comparison is
  38. failing?
  39.  
  40. Some strategically-placed print statements will tell you what is going on.
  41. Don't forget to allow for trailing whitespace and non-printing characters
  42. (consider piping your script's output through "cat -ve", or somesuch).
  43.  
  44. Michael.
  45.