Works like a champuse strict; use warnings; my $data = "line1\nfoobar\nline3\n"; $data =~ s{(foo)(bar)}{ my $one = $1; my $two = $2; $one .= <<'END_TEX +T'; $one.$two; }e; Insert 1 Insert 2 END_TEXT print $data;
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Neva>cd \code\Jff C:\code\JFF>perl regex.pl line1 foo Insert 1 Insert 2 bar line3
In reply to Re: Can't include a HEREDOC within RHS of a Regex
by Anonymous Monk
in thread Can't include a HEREDOC within RHS of a Regex
by wind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |