Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: Executing CGI/web form directives in regex substitution without pages of code

by Polyglot (Pilgrim)
on Feb 19, 2020 at 22:44 UTC ( #11113195=note: print w/replies, xml ) Need Help??


in reply to Re^3: Executing CGI/web form directives in regex substitution without pages of code
in thread Executing CGI/web form directives in regex substitution without pages of code

That's a great question, and until you asked it, I hadn't even caught that. (I had just copy/pasted the error straight from the log, and noticed it was focused on that regex section.)

The code did not contain a double backslash. I copied that line exactly as you had posted it, and it was and still is as follows in the code:

foreach my $line (@data) { push @changed, $line =~ s{$s$c$b\K$m(?=$b$c$e)}{$regexR}r; }

I haven't used the //r before. That is new to me. What does it do? I wondered if it might be the syntax error.

Blessings,

~Polyglot~

  • Comment on Re^4: Executing CGI/web form directives in regex substitution without pages of code
  • Download Code

Replies are listed 'Best First'.
Re^5: Executing CGI/web form directives in regex substitution without pages of code
by jo37 (Scribe) on Feb 19, 2020 at 22:52 UTC

    It means:

    Return substitution and leave the original string untouched.

    Maybe it is not available in your version. But you may work around this.

    -jo

Re^5: Executing CGI/web form directives in regex substitution without pages of code
by AnomalousMonk (Bishop) on Feb 20, 2020 at 03:09 UTC

    The  /r modifier for  s/// substitution was added with Perl version 5.14 (see Regexp Quote-Like Operators in perlop). What version of Perl are you using?


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2020-03-30 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    To "Disagree to disagree" means to:









    Results (175 votes). Check out past polls.

    Notices?