Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Secret operators: the documentation

4 views
Skip to first unread message

Philippe Bruhat (BooK)

unread,
Mar 16, 2012, 7:44:38 AM3/16/12
to f...@perl.org
So,

A few years back, I started to write a manual page about Perl secret operators,
with the goal of getting it into the official Perl documentation at some point.

Somehow I got interested in that again, and started to really work on it.
The current work in progress is availabled at: https://github.com/book/perlsecret

I've already included most of the feedback from the discussions on ~~<>.

Patches welcome.

When it's stabilized enough, I'll send a patch to p5p.

--
Philippe Bruhat (BooK)

Too many believe only in the belief.
(Moral from Groo The Wanderer #58 (Epic))

Daniel Bruder

unread,
Mar 16, 2012, 8:05:07 AM3/16/12
to f...@perl.org
Also don't forget it is expandable, and as it is, still (erotic?) perl :-)

perl -e 'print ~~<> => ~~~~<> => ~~~~~~<> => ~~<>+0'

Alexis Sukrieh

unread,
Apr 2, 2012, 12:28:56 PM4/2/12
to f...@perl.org
Le 16 mars 2012 12:44, Philippe Bruhat (BooK)
<philipp...@free.fr> a écrit :
> So,
>
> A few years back, I started to write a manual page about Perl secret operators,
> with the goal of getting it into the official Perl documentation at some point.
[...]
> Patches welcome.
>
> When it's stabilized enough, I'll send a patch to p5p.

Nice work :)

I have a question though;

Did you change your mind about the "A word of warning" section? It
sounds that it won't fit well in the official Perl documentation ;)

My two cents!

Pau Amma

unread,
Apr 2, 2012, 2:14:45 PM4/2/12
to Alexis Sukrieh, f...@perl.org
On Mon, April 2, 2012 4:28 pm, Alexis Sukrieh wrote:
> Le 16 mars 2012 12:44, Philippe Bruhat (BooK)
> <philipp...@free.fr> a écrit :
>> So,
>>
>> A few years back, I started to write a manual page about Perl secret
>> operators,
> [...]
> I have a question though;
>
> Did you change your mind about the "A word of warning" section? It
> sounds that it won't fit well in the official Perl documentation ;)

Version I saw last week-end includes:

===
You're welcome to try these at home, but they might not be safe for work!
===

Is that what you were thinking of?

Andrew Savige

unread,
Apr 3, 2012, 6:43:54 AM4/3/12
to Pau Amma, Alexis Sukrieh, f...@perl.org

I wonder if --$| and $|--, very popular in golf, and described
by japhy as "the magical flip flop variable" at:

 http://www.nntp.perl.org/group/perl.fwp/2002/01/msg1367.html

qualifies as a secret operator?

/-\

Philippe Bruhat (BooK)

unread,
Apr 3, 2012, 7:31:31 AM4/3/12
to f...@perl.org
I've pushed a branch on the Perl source tree, and Abigail already
patched the module a bit.
http://perl5.git.perl.org/perl.git/shortlog/refs/heads/book/perlsecret

The "word of warning" still holds. The page is specifically not listed
in the main perl.pod manual page. The idea is to hide it a little, so that
people who know about it can easily point inquiring minds to it, while not
making these "official".

I also wrote a test script (t/japh/secret.t) and it helped a lot in refining
exactly how and when each of those worked.

--
Philippe Bruhat (BooK)

"Did I err?" (Groo, in too many issues to count - ...and *YES* he did!)

Philippe Bruhat (BooK)

unread,
Apr 3, 2012, 7:34:55 AM4/3/12
to f...@perl.org
I have had several requests for adding more obscure constructs (see
https://github.com/book/perlsecret/issues). My rule has been to keep
only the well-known operators, or the ones that had a nickname that
corresponded to their looks, not their function.

Under that rulle, the magical flip-flop wouldn't have fit.

Anyway, I guess others can decide what gets in when the branch merged
into blead.

--
Philippe Bruhat (BooK)

Out of the worst can often come the best.
(Moral from Groo The Wanderer #57 (Epic))

John Douglas Porter

unread,
Apr 3, 2012, 7:55:12 AM4/3/12
to f...@perl.org

Philippe Bruhat (BooK) <philipp...@free.fr> wrote:
> Andrew Savige wrote:
> >
> > I wonder if --$| and $|--, ... described
> > by japhy as "the magical flip flop variable"
> > qualifies as a secret operator?
>
> My rule has been to keep
> only the well-known operators, or the ones that had a
> nickname that
> corresponded to their looks, not their function.
>
> Under that rulle, the magical flip-flop wouldn't have fit.

Not to mention the fact that it's not an operator. :-)

--
john "many jars" porter

Michael R . Wolf

unread,
Apr 6, 2012, 9:25:09 PM4/6/12
to f...@perl.org
On Mar 16, 2012, at 4:44 AM, Philippe Bruhat (BooK) wrote:

> A few years back, I started to write a manual page about Perl secret operators,
> with the goal of getting it into the official Perl documentation at some point.



A few comments…

1. It would be nice to do a bit of documentation on *why* or *how* some of these work. Perhaps a Deparse would be sufficient (as in Eskimo greeting), but English is also a good tool.

For starters, I didn't figure out how "Ornate double-bladed sword worked". I'm sure I could have created the trail alone, but it would be nice to follow someone else's blaze.

2. Given how dangerous this one could be (to a psyche) if researched deeply (years of therapy…)

=( )= Goatse scalar / list context

I'd suggest another name -- Saturn. Yes, snicker if you will. Saturn *is* the son of the Greek deity Uranus, but that's only a 2nd order, inside joke. The operator looks like Saturn, even when spaces are inserted (as will be likely with syntax formatting editors or perltidy(1))!

=( )= Saturn scalar / list context
= ( ) = Saturn scalar / list context

Keep the old name if you wish, but add one that's more psychologically healthy, too!!! (P.S. Thanks for the warning. That's just plain *responsible* behavior to the community!!! One image could ruin someone's whole view of Perl.)

Michael

--
Michael R. Wolf
All mammals learn by playing!
Michae...@att.net



0 new messages