http://www.perlmonks.org?node_id=331334

davido has asked for the wisdom of the Perl Monks concerning the following question:

I've done the requisite googling on the subject of Duff's Device. Though most examples are in C, I've found one or two in Perl too. ...but they all seem fairly abstract, so I'm still struggling with how it works and where it could/should be used. I tend to do best when I see something put to practical application.

So my questions are as follows: First, why is it legal to use goto to jump into the middle of a do{....} while(); loop? (I know, that's a wired question... it's legal because it is. But the concept still seems a little odd to me). And second, what's a practical example of such a mechanism in real world Perlish use?

This is just a matter of curiosity... no homework here. ;)

Thanks in advance for any comments or pointers.


Dave