What pseudo-operators exist in Perl 5?

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

Leave a Comment