Glenn Golden wrote: >I'd have guessed that both constructs would get optimized away during >compilation, but evidently "{;}" incurs some execution overhead that >"do {;}" does not. A bare block is semantically treated as a loop that executes only once. It incurs the overhead of setting up the context frame that supports dynamic operators such as "next". A do block, on the other hand, provides only scoping, so is much lighter at runtime. There's also optimisation that applies only to do blocks: the dynamic scoping ops will be elided if not needed, as in this case. I suppose in theory the empty bare block could be similarly optimised away, but the applicability would be more limited than what is done with do. You can see the differences by applying "perl -MO=Concise". -zeframThread Previous | Thread Next