in reply to nested Subroutines and my var

Update: Changed accordingly with Roy Johnson reply. I hope I understood correctly what he means. What you say about my vars is correct. If you want a variable to be accessible for other functions calls, use:
our $bar; sub foo { local $bar = 4; # different $bar zbr(); } sub zbr { print $bar; }
This code prints 4.

The correct way is to pass parameters to functions.

Alberto Simões

Replies are listed 'Best First'.
Re^2: nested Subroutines and my var
by Roy Johnson (Monsignor) on Mar 28, 2005 at 20:05 UTC
    Note that our does not create variables, it merely tells Perl that you're going to be using the global variables you list. You should put the our outside of foo, and use local inside it. Then you're strict safe.

    Caution: Contents may have been coded under pressure.