Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: ${^MATCH} sometimes fails in target of substitution?

by ikegami (Pope)
on Jun 17, 2013 at 08:16 UTC ( #1039290=note: print w/ replies, xml ) Need Help??


in reply to Re: ${^MATCH} sometimes fails in target of substitution?
in thread ${^MATCH} sometimes fails in target of substitution?

If you're replacing, there was a successful match. This is a bug.

Testing reveals this bug has been fixed:

$ perl -v | grep 'This is' This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-li +nux-thread-multi $ perl -E'$_ = "abcde"; s/b../==${^MATCH}==/p; say' a====e $ perl -E'$_ = "abcde"; $sub="b.."; s/$sub/==${^MATCH}==/p; say' a==bcd==e
$ perl -v | grep 'This is' This is perl 5, version 18, subversion 0 (v5.18.0) built for x86_64-li +nux-thread-multi $ perl -E'$_ = "abcde"; s/b../==${^MATCH}==/p; say' a==bcd==e $ perl -E'$_ = "abcde"; $sub="b.."; s/$sub/==${^MATCH}==/p; say' a==bcd==e


Comment on Re^2: ${^MATCH} sometimes fails in target of substitution?
Select or Download Code
Re^3: ${^MATCH} sometimes fails in target of substitution?
by space_monk (Chaplain) on Jun 17, 2013 at 10:11 UTC

    Thanks, I amended my answer to reflect your comment and the earlier one of dave_the_m.

    If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039290]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2014-07-13 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (248 votes), past polls