in reply to Re: Where can I find more examples of use of Special Backtracking Control Verbs?
in thread Where can I find more examples of use of Special Backtracking Control Verbs?
This part:/.(?{ do_smth( $& ) })(*FAIL)/ for @lines;
is similar to:/.(?{ do_smth( $& ) })(*FAIL)/
, but it can not(?) be combined with 'for' into one short expression like:do_smth( $& ) while /./g;
Instead I should write:do_smth( $& ) while /./g for @lines; # syntax error
Another variant here was to concatenate all lines: my $concatenated_lines = join $some_concatenator, @lines. And then simply match. But imagine if the regex is more complex and can accidentally match a concatenator as well.do{ do_smth( $& ) while /./g } for @lines;
Note modifiers: e - for eval, and r - for non-destructiveness.s/./ do_smth( $& ) /ger for @lines;
|
|---|