CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
why two same valued variables not equal ?



Feb 3, 2009, 1:55 PM

Post #1 of 2 (345 views)
why two same valued variables not equal ? Can't Post


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 !");
for ($i=0; $i<@W_list; $i++){
@temp=split/\s+/, $W_list[$i];
# 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";}


Feb 3, 2009, 2:07 PM

Post #2 of 2 (344 views)
Re: [robinson] why two same valued variables not equal ? [In reply to] Can't Post

Posting the same question in two different sections on the same forum, not a good idea.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives