in reply to Re^2: searching the strings
in thread searching the strings

I've seen it in the Camel ("2.6. Statements and declarations", "Bare blocks and case structures"), so I thought it would be ok. Indeed I think it's ok since it is listed only as one of several alternatives (another one of which is the one you posted).

--
David Serrano

Replies are listed 'Best First'.
Re^4: searching the strings
by ikegami (Patriarch) on May 10, 2006 at 16:18 UTC

    The alternative the grandparent suggested
    print("error message\n"), next if /^>>/;
    could easily be confused for
    print("error message\n"); next if /^>>/;
    I don't think it's a very good idea.

    At least what you used is well established. It is quite ugly, though. I usually fall back to if/elsif. if/elsif even produces shorter lines:

    foreach (@w) { print "working with $_... "; if (/^>>/ ) { print "error message\n" } elsif (/^\s*([<>])\s*(\S+)/) { print "separated '$1' from '$2'\n" } elsif (/^\s*\|/ ) { print "pipefront\n" } elsif (/\|\s*$/ ) { print "pipeend\n" } else { print "\n" } }

      ++ but I have never been confused, nor have I seen anyone confusing ; for , in this case.

      PS: it was me, not GrandFather...

        I meant "grandparent post", not "post by GrandFather".