Alex Rivera | Logout

Is using labels in Perl subroutines considered a bad practice?

Asked 2009-10-28T08:56:28.697
9

I find that using labels inside Perl subroutines, to break from multiple loops, or to redo some parts with updated variables, very helpful. How is this coding style seen by the community? Is using labels inside subroutines frowned upon?

Edit
Report

1 Answer

18

No. They serve exactly the purpose your describe and I consider them a nice feature of the language that gets used too little.

On the other hand, whenever I find myself pondering the use of a label, I also find myself wondering whether my code needs a little refactoring.

answered 2009-10-28T09:06:22.907

Your Answer