in reply to How to add perl variable before any text in perl code

And do, please, consider giving your eyes and sanity a huge break by thinking about using balanced delimiters — and maybe even some whitespace:

c:\@Work\Perl\monks>perl -wMstrict -le "my $xxx = 'YYY'; ;; my $boxtxt = 'aaa</boxed-text>bbb'; print qq{'$boxtxt'}; ;; $boxtxt =~ s{ </boxed-text> } {</new-stuff xxx${xxx}xxx>}xmsg; print qq{'$boxtxt'}; " 'aaa</boxed-text>bbb' 'aaa</new-stuff xxxYYYxxx>bbb'
See perlre and perlretut, and  m// s/// qr// qq// etc. in perlop.

Replies are listed 'Best First'.
Re^2: How to add perl variable before any text in perl code
by marto (Cardinal) on Dec 10, 2014 at 17:33 UTC

    Also, something to consider, a templating system to separate your perl code from the HTML, etc.

Re^2: How to add perl variable before any text in perl code
by ww (Archbishop) on Dec 10, 2014 at 17:29 UTC

    ++ AnomalousMonk for concern for OP's eyes; addendum: OP needs to be kind to our eyes, too (AKA: make it easy for us to help)!



    check Ln42!