lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jul 9, 2014, at 8:26 PM, mniip <mniip@mniip.com> wrote:

> On 07/10/2014 04:05 AM, Coroutines wrote:
>> On Wed, Jul 9, 2014 at 5:03 PM, Paige DePol <lual@serfnet.org> wrote:
>> 
>>> What other strange operators have been spotted in the wild?
>> The spaceship operator is my favorite ("<=>"):
>> https://en.wikipedia.org/wiki/Spaceship_operator
>> 
> How about the goatse operator, ''=()='', which forces RHS into an array
> context?
> 
> Example usage:
> 
>    $a = "hello world" =~ /l/g; # $a gets 1 (or undef if the pattern
> wouldn't have matched)
> 
>    $a =()= "hello world" =~ /l/g; # $a gets 3, the amount of times the
> pattern matched

Jeez, I did some pretty serious perl hacking back in the day and can't say I've ever heard that called the goatse operator... too funny... and now I can't stop seeing goatse when I see =()= so um, thanks? Off to Amazon to order some brain bleach! ;)

I did find a list[1] of other "secret" perl operators, some of which I did not actually know had names! 

~pmd

[1] http://www.catonmat.net/blog/secret-perl-operators/