It doesn't work because you removed the 'x' the first time around.
$val = 1; while ($val < 5) { $foo = "some sentence x"; # Move this here $foo =~ s/x/$val/; print "$val $foo\n"; $val++; }
or
$foo = "some sentence x"; $val = 1; while ($val < 5) { my $foo = $foo; # Add this. $foo =~ s/x/$val/; print "$val $foo\n"; $val++; }
In reply to Re: substitution not recompile
by ikegami
in thread substitution not recompile
by adjohan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |