
robinson
Novice
Feb 3, 2009, 1:55 PM
Post #1 of 2
(230 views)
|
|
why two same valued variables not equal ?
|
Can't Post
|
|
Hello! I created two variable with same value, one was assigned using "=", the other was read from a file, both have the same string ( I have checked the many times), such as "A009", but when I compare them using if ( $A eq $B), they are not equal. even when I compare $A or $B with the assigned string 'A009', they are not equal either! #@% Below shows the code , the last comparison within for loop returned as not equal, what might be wrong? Thanks in advance! open ( IN_F0, "<$ARGV[0]") or die ("can not open !"); @W_list=<IN_F0>; for ($i=0; $i<@W_list; $i++){ @temp=split/\s+/, $W_list[$i]; $Well_NO[$i]=$temp[1]; # print "$Well_NO[$i], $i\n\n"; } $value = A009; for($j=0; $j<$i; $j++) { print "$Well_NO[$j]\n"; #if( $Well_NO[$j] eq 'A009'){print "good !!!\n";} if( $Well_NO[$j] eq $value ){print "good !!!\n";} } close(IN_F0); ~
|