> Perl subroutines keep parameters and variables local by default

No they don't.

You have to explicitly tell them to do so.

        $foo = 10;

        do_stuff();

        print "foo is now $foo\n";

        sub do_stuff {
                $foo = 12;
        }

or even:

        @foo = 1 .. 10;

        do_stuff_with(@foo);

        print "foo is now <@foo>\n";

        sub do_stuff_with {
                $_++ foreach @_;
        }

(Yes, I know this is because of pass by reference).


Tony



_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to