in reply to ${^POSTMATCH} problem
The following code (perl v5.28.2) seems to do what you want; of course the matches are no longer in the same dynamic scope since the concatentation over all strings is no longer being utilized.
Outputs:use warnings; use strict; use v5.10; sub add_incr_suffix { state $suffix = 'A'; return "prefix-TEXT-" . $suffix++; } print "Test \n"; print add_incr_suffix =~ /^prefix-*/p ? ${^POSTMATCH} : '', ", "; print add_incr_suffix =~ /^prefix-*/p ? ${^POSTMATCH} : '', ", "; print add_incr_suffix =~ /^prefix-*/p ? ${^POSTMATCH} : '', "\n";
Test TEXT-A, TEXT-B, TEXT-C
In anycase, seems like you may have been depending on a bug for some behavior that is no longer present.
|
---|