William schreef:

>> Testing with a numeric operator also "works", see below:
>>
>> $ perl -Mstrict -Mwarnings -MData::Dumper -wle'
>>    my $s = "1234";
>>    print Dumper($s);
>>    print 1 if $s == 0;
>>    print Dumper($s);
>>    print 2 if $s eq "1234";
>>    print Dumper($s);
>> '
>> $VAR1 = '1234';
>>
>> $VAR1 = 1234;
>>
>> 2
>> $VAR1 = 1234;
>>
>
> That is interesting.

Yes, and knowing this can save you performance loss. For example with
mod_perl a variable doesn't stay shared (between forked off processes)
if any of its guts get changed. This leads to code like:

    our $shared_number = "123.45"; $shared_number == $_ and 1 for 0,
0.1;

If you do this before forking, the variable has much more solid guts. :)

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to