*alexandre* has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys, I'm facing a new error and I could not figure out what happen here is the code snippet
sub evalDealView { my $string;my $string2; my $content; my $username = $query->param("username"); $lang = $query->param("lang"); loadLanguage(); my $index_a = $tableArticle->loadEvalBuyPositivIndex();#print "Con +tent-Type: text/html\n\n"; my $table_a = $tableArticle->loadEvalBuyPositivTable(); my $index_b = $tableArticle->loadEvalBuyNegativIndex(); my $table_b = $tableArticle->loadEvalBuyNegativTable(); open (FILE, "<$dir/evaldealview.html") or die "cannot open file $d +ir/evaldealview.html"; while (<FILE>) { #s/\$LABEL{'([\w]+)'}/ exists $SERVER{$1} ? $SERVER{$1} : $1 / +eg; s/\$LANG/$lang/g; s/\$ARTICLE{'evaldealviewindex'}/$index_a/g; s/\$ARTICLE{'evaldealviewtable'}/$table_a/g; s/\$ARTICLE{'evaldealviewnegindex'}/$index_b/g; s/\$ARTICLE{'evaldealviewnegtable'}/$table_b/g; s/\$ERROR{'([\w]+)'}/g; $content .= $_; } return $content; }
the line incriminate is the following
$content .= $_;
The error message is the following Bad evalled substitution pattern. Thanks in advance for your patience.

Replies are listed 'Best First'.
Re: Bad evalled substitution pattern
by haukex (Archbishop) on Jan 02, 2023 at 13:19 UTC
    The error message is the following Bad evalled substitution pattern.

    According to perldiag:

    You've used the /e switch to evaluate the replacement for a substitution, but perl found a syntax error in the code to evaluate, most likely an unexpected right brace '}'.

    However, the only regular expression in your example that uses /e is not only commented out, but is valid syntax.

    The code you showed actually produces the error message "Substitution replacement not terminated".

    We can only help you if you follow the advice in How do I post a question effectively?, I know what I mean. Why don't you?, and SSCCE.

      Already fixed but thanks.
Re: Bad evalled substitution pattern
by Corion (Patriarch) on Jan 02, 2023 at 09:15 UTC

    The line

    $content .= $_;

    is not the line where the error is, but the line above it. The second slash is missing here:

    s/\$ERROR{'([\w]+)'}/g;