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 ?

#notdeadyet #morelinenoise @Perl

@Pyrrhlin @Perl
I think it would also be equivalent to:

{ no warnings 'unintitialized';
$val =~ s/$prefix// }

Or am I missing something here?

This seems more like a code smell to me. If you need to preprocess the content of the scalar, is it warranted for the scalar to still be potentially undef afterwards?

Beware: The seemingly similar '//=' operator does assign something only if the scalar is NOT defined. Your proposed operator would do something only if the scalar IS defined.