[Edinburgh-pm] Spot the bug

Miles Gould miles at assyrian.org.uk
Wed May 1 03:03:13 PDT 2013

On 29/04/13 11:10, Aaron Crane wrote:
> I did detect the bug by inspection — you narrowed it down very
> conveniently, after all

Yes: as you may have guessed, my code only took on the form shown after 
several rounds of refactoring for greater testability. But note that 
this problem would also have occurred if I'd just assigned the result to 
a variable:

$ perl -E 'my $fred = 0 xor 1; say $fred'

I conclude from this that Perl's xor operator has the wrong precedence, 
and one should always bracket it.


More information about the Edinburgh-pm mailing list