Re: how these two variables are equal numerically? it's: 0 == 0

Hoffmann schrieb:
> Dr.Ruud wrote:
>> Hoffmann schreef:
>>  
>>> Could some one explain how, in the example below, $name and $goodguy
>>> are equal numerically?
>>>
>>> $name = 'Markkkk';
>>>
>>> $goodguy = 'Tony';
>>>
>>> if ($name == $goodguy) {
>>>         print "Hello, Sir.\\n";
>>> } else {
>>>         print "Begone, evil peon!\\n";
>>> }
>>>     
>>
>> Try also with something like
>> #!/usr/bin/perl
>>   use strict;
>>   use warnings;
>>
>>   my $name    = '1Markkkk';
>>   my $goodguy = '2Tony';
>>
>>
>>   if ($name eq $goodguy) {
>>       print "Hello, Friend.\\n";
>>   }
>>   elsif ($name == $goodguy) {
>>       print "Hello, Anyone.\\n";
>>   }
>>   else {
>>       print "Begone, evil peon!\\n";
>>   }
>>
>> __END__
>>
>>   
> I did exactly that. And I know that the correct way to compare strings
> is by using 'eq'. The question is: by considering the original post,
> which value Perl 'gives' to those numerical variables? Is it 1==1?
> 


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


