New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/r modifier on substitutions - variant returning undef if no match #12245
Comments
From @epaCreated by @epaThe new /r flag introduced for the s/// and tr/// operators in perl my $old = 'cat'; While the intention of /r is to simplify the use of substitution, I suggest a variant which performs the substitution and returns my $new = $old =~ s/cat/dog/R // die; my @new = map { s/cat/dog/R // die } @old; Perl Info
|
From @rjbsOn Tue Jul 03 03:01:56 2012, eda@waniasset.com wrote:
My feeling is that in this case, the user should simply use the non-r form. I am open to hear |
The RT System itself - Status changed from 'new' to 'open' |
From @epaRicardo SIGNES via RT <perlbug-followup <at> perl.org> writes:
You could well be right. In my experience, checking that the match succeeded is -- |
From @LeontOn Tue, Jul 24, 2012 at 12:04 PM, Ed Avis <eda@waniasset.com> wrote:
My experience is different. I use /r quite regularly, and have an Leon |
From @xdgOn Tue, Jul 3, 2012 at 6:01 AM, Ed Avis <perlbug-followup@perl.org> wrote:
Yes, but what if the original string was undef? (warnings aside) We Even if semantics could be worked out (die unless match?) I agree with I do think the documentation might need to reflect this issue and -- David |
From @ikegamiOn Tue, Jul 24, 2012 at 5:04 AM, Ed Avis <eda@waniasset.com> wrote:
That's a huge exception, and /r finally made it so it was cleaner not to do sub trim { $_[0] =~ s/^\s+//r =~ s/\s+\z//r } My point is that /r wasn't a mistake, so let's not bring that into the |
Migrated from rt.perl.org#113962 (status was 'open')
Searchable as RT113962$
The text was updated successfully, but these errors were encountered: