

Secret Perl Operators - pkrumins
http://www.catonmat.net/blog/secret-perl-operators/

======
DougWebb
Many of these don't pass muster as Modern Perl development, or any
professional software development. As a code reviewer, I'd reject everything
but <=> and @{[ ... ]} as being too cryptic. <=> passes because it's the
standard way to compare numbers in sort routines, and @{[ ... ]} passes
because it's the standard way to interpolate lists and function call return
values into strings.

}{ Useful for one-liners, but has no use in production code.

=()= In production code, I'd prefer to see the match results assigned to a
named array, and the array used in a scalar context to get the length.
Alternatively, I'd accept a comment explaining why there is an assignment to
an anonymous array. It had better not call =()= an operator, though.

~~ You can force scalar context using the scalar keyword, which is much
clearer.

~- You can type $x-1, which is much clearer and works for numbers <= 0 too.

-+- I didn't know "3.99" was an integer... in any case, would probably use printf or sprintf for formatting numbers for display, using explicit formats rather than relying on whatever -+- spits out.

0+ Again, I would use printf or sprintf in most cases where 0+ might be used.

~~~
SwellJoe
_}{ Useful for one-liners, but has no use in production code._

What about production one-liners? Let us not underestimate the power of a
well-applied one-liner.

~~~
joe_the_user
I wouldn't underestimate the power of a one-liner.

That's why I'd avoid using one!

 _With great power comes great responsibility_ \- and it's hard to cram the
responsibility part into one line as contrasted with a clear, well-behaved
subroutine.

------
elblanco
Oh Perl, will you never stop being a source of witty fun?

------
henning
It's official, Haskell's boob combinator, (.) . (.), has competition. From the
Goatse operator.

------
pmorici
Alternate title: "8 Reasons Not to Use Perl". Why do people who use Perl get
such a kick out of junk like this.

~~~
elblanco
Perl is designed around linguistic concepts. You may as well ask "why do
people who use language get such a kick out of junk like this:poetry, rhymes,
prose, novels, etc.?"

~~~
pmorici
I don't think it is but to go along with the metaphor, those things you list
are methods of conveying stories and emotions. A programming language is a
method for conveying instructions to a _machine_. Theses would be 8 reasons
not to use any human<->machine language. The Perl biosphere just seems to
produce non-sense like this as a matter of routine. To me posts like this are
about on par with pictures of cats.

~~~
chromatic
> A programming language is a method for conveying instructions to a
> _machine_.

The preface of SICP disagrees (see
<http://mitpress.mit.edu/sicp/front/node3.html> ), with a quote many, many
programmers can quote in spirit if not to the letter.

~~~
Semiapies
These operators sound even worse for people to read; perhaps that's why
they're obscure.

