in reply to Replace method

B::Deparse can be your friend when things aren't causing syntax errors but don't behave the way you expect. You may find that Perl's not understanding things the same way you intended.

gamera:~ 602> perl -MO=Deparse,-p,-q <<'EOT' heredoc> my $page = "page_name.tmpl"; heredoc> my $mdl = $page =~ s/\.tmpl/\.pl/i; heredoc> EOT (my $page = 'page_name.tmpl'); (my $mdl = ($page =~ s/\.tmpl/.pl/i)); - syntax OK