good chemistry is complicated, and a little bit messy LW 

PerlMonks 
Comment on 
( #3333=superdoc: print w/ replies, xml )  Need Help?? 
Upon writing
$a % 0
I am told that 0 is an illegal modulus.
However, according to "Concrete Mathematics: A Foundation for Computer Science", by Graham, Knuth (yes, that Knuth) and Patashnik 2nd ed. (page 82) x mod y is defined as x  y{x/y} (where {} is floor) for y!=0, and x mod 0 is defined to be x.This definition is justified; it preserves the property that x mod y always differs from x by a multiple of y, and makes sense if you think of it this way: x mod y means "map y to 0", so if y already is 0, then there is nothing to do, and x mod 0 should be congruent to x. Yes, I know that division by 0 is a Bad Thing, but technically we are not dividing, we are defining the mod operator. So this is more of a rant than a question, but it annoys me to lose functionality from one of my favourite operators in such an amusing language as Perl. In reply to 0 illegal modulus? by nella

