only tangentially related, but one of the things I miss so much about Perl is that, as in English, you can add an "if" or "unless" clause as an afterthought.
$x++ if (!condition);
like if you start to increment $x++ and then you realize wait a second I only mean if....
"unless" likewise functions as an "if not".
This is such a "natural" way to write.
Let's compare what happens if you have the thought to add a "statement modifier" in any other programmer language.
you're written your statement, and now you have to go back to the beginning of your line, write your condition, open a brace, go back to the end of the line, and close your brace. Or maybe begin an entire code block, since you can't have it on one line anymore.
it is so much less natural. why can't other programming languages have that?
Ruby has that. But you have to be careful that your code stays readable. I know that's not a concern for Perl. :-)
Although the "unless" case very often trips me. Somehow my brain can't parse that correctly and I've found that surprisingly many work colleagues have the same problem.
<result> if/unless <condition> is pretty common in natural language for good reason. I find it far more readable than prefix, block-form if for the simple case of one-line results with no alternative branch.,
$x++ if (!condition);
like if you start to increment $x++ and then you realize wait a second I only mean if....
"unless" likewise functions as an "if not".
This is such a "natural" way to write.
Let's compare what happens if you have the thought to add a "statement modifier" in any other programmer language.
you're written your statement, and now you have to go back to the beginning of your line, write your condition, open a brace, go back to the end of the line, and close your brace. Or maybe begin an entire code block, since you can't have it on one line anymore.
it is so much less natural. why can't other programming languages have that?