
aixrus
New User
May 21, 2010, 10:30 AM
Post #1 of 3
(1245 views)
|
Basic comparison problem
|
Can't Post
|
|
Goal: read all lines of a file, colon delimited, searching for a specific server name (always located in the first field). If the current server equals the servername in that 1st field, then populate 2 other variables based on 2nd and 3rd fields. On an aix system. When I try to compare strings using eq, it always evaluates true. When I try with == it always evaluates false. Where system hostname = x100 /inputfile reads: x100:KRB Master:NIM x101:Some other stuff:Cognos, WAS $host=`hostname`; # Read the Description File $desc_file="/inputfile"; open(INP, $desc_file) || die("Could not find $desc_file ! Aborting!"); $text = <INP>; while ($text){ ($ahost)=split(/\:/,$text); if ( $host eq $ahost ){ ($ahost,$desc,$apps)=split(/\:/,$text); } $text = <INP>; } Thanks ahead for help!
|