Code:

$ffo = '<h1 style="padding: 0px; margin: 0px; margin-top: 5px;">876/8+4'; $rro = '876/8+4'; # получено из $form->param("name1") при use CGI; $ffo =~ s/$rro//; print $ffo; 

Displays:

 <h1 style="padding: 0px; margin: 0px; margin-top: 5px;">876/8+4 

It also works if there is a '\' in the template. If plus remove or four, all works. Advise a beautiful solution, plz.

    2 answers 2

     $ffo =~ s/\Q$rro\E//; 

      What if:

       print $ffo if $ffo =~ s/$rro//; 

      or

       print $ffo if $ffo =~ /$rro$/; 

      If I do not understand something write what exactly do you expect to receive? Line: padding: 0px; margin: 0px; margin-top: 5px; padding: 0px; margin: 0px; margin-top: 5px; ?

      • The string <h1 style = "padding: 0px; margin: 0px; margin-top: 5px;"> The problem was that in the variable used as a search pattern, there is a slash, plus, and there can be any characters passed to form. - dipp