|There's more than one way to do things|
syntax highlighting is fantastic, and yet i've never seen an editor get it right for perl.
Yep, but then I bet that even perl, which can properly parse Perl, would have some difficulties syntax-highlighting certain kinds of code in a meaningful manner. OTOH most smart enough editors do a decent job on most reasonable and common code. Sometimes you have to trick them or help them in some way. Mine not only helps me with SH, but also does automatic indentation etc. but again in some cases it gets it wrong, e.g. with
In this case the closing parenthesis is seen as quoted, and this screws up the following lines of code. Of course using
instead prevents the problem, and is also clearer a priori, but it was just to come out with a reasonably "real" enough example.
Similar situations when here docs are included, even more so if they actually contain code. Then, in the rare situations in which I need to do a string eval, I prefer
Over simple quotes, since then my editor won't recognize them as strings, but mistake them for code blocks, which is fine in this case. The Right Thing™ would have been... ehm "wrong" in this case.
In some regexen like the one you mentioned, I overquote inside the regex, just not incur your same problem.
Oh, and as a minor point, comments are only recognized if there's some whitespace on the left of #. So I always include some, but that's not a big harm since I consider it a good practice anyway. OTOH when I have to comment out big portions of code I use the "indent region" function of the editor itself, which is a big help especially in connection with its "unindent region" companion.
One thing that is occasionally annoying is the confusion between "multi line" anonymous hashrefs and code blocks: to cope with that I often put parentheses instead, that I substitute with curlies later. Not terribly hard, but... well, annoying.