in reply to Re^3: searching the strings
in thread searching the strings
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" } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: searching the strings
by blazar (Canon) on May 11, 2006 at 08:34 UTC | |
by ikegami (Patriarch) on May 11, 2006 at 14:28 UTC |