in reply to Re^2: Circular buffer
in thread Circular buffer

I usually avoid code like $pointer = (++$pointer) % @buffer; where the same variable is modified twice within the same expression. It means that the outcome depends on the order of evaluation, which isn't defined in all cases (it is in the case of assignment though).

Instead I'd just write $pointer = (1 + $pointer) % @buffer.