[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

OT:Perl %= operator


I hope I'm not abusing list by asking this question here. It's the only
list I use regularly so I'd prefer to ask it here than go to a Perl
list. But if this is quesionable behavior please let me know.

I've been reading the most recent Randall Schwartz column in SysAdmin
magazine and his code has this line:
($start +=1) %=7;
If $start = 1 then I think that this line means 2%7. I believe that the
intended result is 2 but I'm just not sure what 2 % 7 equals. I know
that 7%2 = 1 but I'm not sure what happens with modulus when the 2nd
number is greater than the first. I've gone through about 6 books
looking for the answer but none of them consider the case where the 2nd
number is larger than the first.

Again excuse me if this is an improper posting.



Reply to: