Alex Rivera | Logout

What does for (;;) mean in Perl?

Asked 2010-04-29T13:14:02.050
15

I was looking though a fellow developers code when I saw this ..

for (;;){
   ....
   ....
   ....
}

I have never seen ";;" used in a loop. What does this do exactly?

Edit
Report

1 Answer

27

It loops forever. ';;' equates to no start value, no stop condition and no increment condition.

It is equivalent to

while (true)
{
   ...
}

There would usually be a conditional break; statement somewhere in the body of the loop unless it is something like a system idle loop or message pump.

answered 2010-04-29T13:15:08.743

Your Answer