http://www.perlmonks.org?node_id=564834


in reply to Re: Secret Perl Operators: the boolean list squash operator, x!!
in thread Secret Perl Operators: the boolean list squash operator, x!!

I think that will be more intelligible to those who aren’t familiar with the idiom.

I don’t know. Shouldn’t that mean it should be written with one more space, x ! !? I think the hard-to-grasp part is actually why/how () x $boolean works; the addition of !! doesn’t make it appreciably more difficult to understand, in my opinion.

Makeshifts last the longest.

  • Comment on Re^2: Secret Perl Operators: the boolean list squash operator, x!!

Replies are listed 'Best First'.
Re^3: Secret Perl Operators: the boolean list squash operator, x!!
by xdg (Monsignor) on Jul 31, 2006 at 19:42 UTC

    Because !! is a (moderately known) idiom as well (the "boolification" operator), I don't think that needs to be split up. My snap reaction to seeing ('foo') x!! $bar is a "huh?" until my brain parses x!! into two separate things. My snap reaction to ('foo') x !!$bar is immediately "list repeated boolean times".

    Separately, I was thinking of parallels to "boolification" for a name, but it's not true or false -- it's a "there or not there" operator. That made me think first of the Cheshire Cat fading in and out, and the cat idea reminded me of Schrodinger's Cat and other quantum mechanical metaphors. Maybe there's a good name in there somewhere.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.