perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: svn commit: r239724 - /perl/modperl/trunk/lib/Apache2/Build.pm
Date Wed, 24 Aug 2005 21:44:42 GMT
Philip M. Gollucci wrote:
> Stas Bekman wrote:
> 
>>> +sub cmp_tuples {
>>> +
>>> +    my($a, $b) = @_;
>>> +
>>> +    while (@$a && @$b) {
>>> +        my $cmp = shift @$a <=> shift @$b;
>>> +        return $cmp if $cmp;
>>> +    }
>>> +
>>> +    return @$a <=> @$b;
>>> +}
>>
>> Philip, please avoid using $a and $b in any code, but sort()
>> callbacks, as they are special in perl and may have bad side effects.
> 
> Gozer wrote that :)

Yup, it was only an example ;-) But, really, stas is correct, $a and $b can
have some nasty side effects.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Mime
View raw message