delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/01/20/23:26:38

From: dbe AT wgn DOT net ($Bill Luebkert)
Subject: Re: opposite.
20 Jan 1998 23:26:38 -0800 :
Message-ID: <34C3D130.EADD15D4.cygnus.gnu-win32@wgn.net>
References: <2A89ACC39E45D111A61A00805FC1EDD9035132 AT us-sd-pt-loma-tech-dms DOT saic DOT com>
Mime-Version: 1.0
To: "mark.g.franz" <MARK DOT G DOT FRANZ AT cpmx DOT mail DOT saic DOT com>,
"gnu-win32 AT cygnus DOT com" <gnu-win32 AT cygnus DOT com>

mark.g.franz wrote:
> 
> I had a difficult time getting 'ne' to work on a script last week, I
> ended up setting a quick variable, then checking to see that it wasn't
> true,
> 
> while (<DATA>) {
> if ($name eq $uname) {
> $nodata = "no";       # This is important, tricks the system to check
> for a match, if none found, then run MORE STUFF
> print STUFF "
> "
> last;
>         } # end if
> else {
>         $nodata = "yes";
>         }  #end else;
> } # End WHILE
> close DATA;
> if ($nodata eq "yes") {
> print MORE STUFF"
> "
> } # End IF

This makes no sense at all.  If "ne" fails, (ie: skips to } or else), it's because the 
2 strings are the same.  The same is true for "eq", if it fails and goes to } 
or else, it's because the 2 strings don't match.

The main reason for people thinking they are failing, is probably because 
there is "invisible" stuff in one or both strings causing an apparent 
failure of the if when really the failure is not a failure at all but 
just a match/mismatch (depending on whether you're using eq or ne) in the 
2 strings.

I challenge you to post a script that fails eq or ne when it shouldn't.
Make sure you provide the data file if not local data.

-- 
  ,-/-  __      _  _         $Bill Luebkert
 (_/   /  )    // //       DBE Collectibles
  / ) /--<  o // //      http://www.wgn.net/~dbe/
-/-' /___/_<_</_</_    Mailto:dbe AT wgn DOT net
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019