I am currently documenting all of Perl 5\'s operators (see the perlopref GitHub project) and I have decided to include Perl 5\'s pseudo-operators as well. To me, a pseudo-o
The Perl secret operators now have some reference (almost official, but they are "secret") documentation on CPAN: perlsecret
Nice project, here are a few:
scalar x!! $value # conditional scalar include operator
(list) x!! $value # conditional list include operator
'string' x/pattern/ # conditional include if pattern
"@{[ list ]}" # interpolate list expression operator
"${\scalar}" # interpolate scalar expression operator
!! $scalar # scalar -> boolean operator
+0 # cast to numeric operator
.'' # cast to string operator
{ ($value or next)->depends_on_value() } # early bail out operator
# aka using next/last/redo with bare blocks to avoid duplicate variable lookups
# might be a stretch to call this an operator though...
sub{\@_}->( list ) # list capture "operator", like [ list ] but with aliases
The "goes to" and "is approached by" operators:
$x = 10;
say $x while $x --> 4;
# prints 9 through 4
$x = 10;
say $x while 4 <-- $x;
# prints 9 through 5
They're not unique to Perl.