If you change the code to (my $mdl = $page) =~ s/\.tmpl$/\.pl/;, then the first thing that happens is that $mdl is set to the value of $page, and because it is the left-hand side of the assignment, $mdl then becomes the target of the =~ binding operation. Note the '$' anchor borisz and I added to the regex - this helps ensure you only change what you intend. What if $page = "my.tmplate.tmpl"?
In reply to Re: Replace method
by virtualsue
in thread Replace method
by rsiedl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |