in reply to Re^4: while(){}continue{}; Useful? (Consistent!)
in thread while(){}continue{}; Useful?

No nesting required?

LINE: while ( <STDIN> ) { unless( /^#/ # its a comment or /^$/ # or blank line ) { ... ## do whatever } $count++; ## and count them all }

Update: Darn! Wrong place!


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^6: while(){}continue{}; Useful? (Consistent!)
by LanX (Saint) on Mar 04, 2010 at 01:22 UTC
    > > > This produces identical results, and IMO is far clearer and more intuative:

    > > Not with multiple nexts and code in between.

    underlines added!

    UPDATE: Think of it like a switch statement with a fall through to the continue block.

    Cheers Rolf