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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



robinson
Novice

Feb 3, 2009, 1:55 PM

Post #1 of 2 (259 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);
~


eWish
User

Feb 3, 2009, 2:07 PM

Post #2 of 2 (258 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