in reply to Create a new operator, get LHS

You mean like: if (grep {$_ eq $var} @list) where the var part can be an arbitrarily complex function?

I don't know about the guts, but List::Utils has a bunch of stuff that does similar things you might want to look at.

Replies are listed 'Best First'.
Re^2: Create a new operator, get LHS
by Eily (Monsignor) on Aug 25, 2015 at 17:17 UTC

    The var part can't be an arbitrarily complex expression, as it gets computed for each element of @list:

    perl -E 'say q<Nope> unless grep { $_ eq $c++ } 1..10; say $c' Nope 10

      Although it is a bit silly with side effects, that code works fine as you demonstrated.

      It isn't very complicated, but arbitrarily complex includes 'simple'. You're also free to start an OpenGL window, slam down some matrix transforms based on $_ and use that result as the grep condition.