note
clintp
I couldn't possibly disagree more.
<p>
Just so everyone understands that you're not just afraid of <code>goto</code>, let's take a look at a few pieces of syntax:
<ul>
<li><code>while(<FH>)</code> assignment to <code>$_</code>
<li><code>{ local $/; $a=<SLURP>; }</code>
<li><code>sub cntr { my $r=0; return sub { $r++ }; }</code>
<li><code>$a="aaaa"; $a++</code>
<li><code>map {...} sort {...} map {... } </code>
<li><code>grep { s/foo/bar/ } @arr</code>
<li><code>*copy=\$original;</code>
</ul>
Are these pieces of code obscure (though documented) tricks? Arguably, to someone new to Perl they're <i>all</i> tricks. Most of these can't be attempted (in their current form) in C, Shell, Java, Pascal, REXX, FORTRAN, or Basic without throwing a lot more code at the problem. So a programmer with 25 years of fairly broad experience could claim that these are all witchcraft of the worst sort and insist you avoid them. (All of these have an alternate "workaround" in Perl that could be used for "clarity.")
<p>
But, in fact, they're all fairly idiomatic and common Perl. One programmer's "trick" is another programmer's tool. When does a "trick" become an idiom?
<p>
I'd use any of them in a heartbeat if it was the appropriate tool for the job. I would hope you would too. Coding for clarity is one thing, wearing shackles is quite another. If the syntax is there, documented, and not deprecated -- use it.
<p>
Those that fear and are unable to deal with large languages should stick to C.
129788
129866