On Thu, Jun 27, 2013 at 1:31 PM, Dr.Ruud <rvtol+use...@isolution.nl> wrote:
> On 27/06/2013 22:01, Shawn H Corey wrote: > >> On Thu, 27 Jun 2013 21:53:46 +0200 >> "Dr.Ruud" <rvtol+use...@isolution.nl> wrote: >> > See also 'Statement Modifiers' in perlsyn. >>> There it is shown how to make next and last work with do{}. I read >>> that as a rather funny way to discourage people from do-ing it. >>> >> "Here be dragons." I would say that was a warning to avoid it >> altogether. >> > > The "Here be dragons." there, is about something different, namely the "my > $x if ... ;" type of code. > (at least in the version I last read, 5.14.2 > > True. But, "do" should probably draw a more explicit caution in the docs since there are less tricky ways in most cases. However, there may be a few places when 'do' isn't always a don't :) 'do' might be a shorter, more readable idiom in the sense of "do something until a condition occurs": perl -e 'do {$in =<>; ... } until $in =~ /q/' vs. perl -e 'while ( $in = <>; ... ) { ... last if $in =~ /q/}' -- Charles DeRykus