Duff’s device is a ingenious and nails-on-chalkboard irrating C “idiom” that was designed to move bytes serially into some hardware device (not memory, probably a video card(?)). It exists because a simpler while loop took too long. It is an example of loop unrolling, a technique somewhat unused in Perl because it is only justifiably employed in high performance applications (eg. animation, games). What makes this code so abhorrant is that it looks like the result of a high-speed impacted between a switch statement and a while loop.

Please, please, great Larry and Damian, do not let Perl 6 allow insanity like this. Perhaps this is the reason Perl has no switch statement?

[Original use.perl.org post and comments.]