I had need for a new #perl operator today, like:
$val //~ s/$prefix//;
that would be equivalent to:
$val =~ s/$prefix// if defined $val;
is it too late to get this for v5.42 ?
I had need for a new #perl operator today, like:
$val //~ s/$prefix//;
that would be equivalent to:
$val =~ s/$prefix// if defined $val;
is it too late to get this for v5.42 ?
@Pyrrhlin I do it all the time for cheap regexp-based switches, as described in perlfaq7: https://perldoc.perl.org/perlfaq7#How-do-I-create-a-switch-or-case-statement?
```
SWITCH: for ($pizza) {
/pepperoni/ and do {say 'yum!'; last SWITCH};
/anchovies/ and do {say 'yuck!'; last SWITCH};
}
```
@Pyrrhlin I like to see the test first when reading from left to right.
Per #perlcritic I reserve postfix controls for program flow control functions like return, last, next, etc. https://metacpan.org/pod/Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls