my @buffer = (0) x 5; for (0..30) { print "old value: ", $buffer[0], "\n"; print "new value: $_\n"; shift @buffer; push @buffer, $_; }
In reply to Re^3: Circular buffer
by repellent
in thread Circular buffer
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |