I am having problems matching strings.  I have the
following code that reads a file with computer names
and if a named passed to the script is in the file
print yes otherwise print no, for example. The
computer names are in the format n-4.t-1 meaning node
four on rack 1.

while(<FILE>) {
   $line = $_;
   chomp($line);
   $_ = $name_passed; # name is the argument passed to
this script
   if (/$line/) {
       print "yes\n";
       exit 0;
   }
}
print "no\n";

Now, if the file contains computer n-4.t-1 and I want
to see if computer n-4.t-11 exists in the file (which
it doesn't) the script return yes because it matches
n-4.t-1.  However, the file might contain the entry
"t-2" which means that all the nodes on rack 2 need to
be disabled.  So, if I passed the script the name of
n-4.t-2, the script should return "yes" because that
nodes is part of rack 2.

Any ideas anyone???

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to