[sf-perl] Scope of a variable

Bill Moseley moseley at hank.org
Thu Mar 8 13:48:06 PST 2007


On Thu, Mar 08, 2007 at 01:08:30PM -0800, nheller at silcon.com wrote:
> 
> Following is a cut-down version of what I'm trying to do.
> The problem I'm having is that the variable, $intendedDest, is not holding
> its value from the called code (in Navigate.pl) to the calling code
> (Migrate.pl).

Instead of using globals, which you will hate yourself for in the
morning, how about returning the value you want:

(not really following the problem you are trying to solve)


    my $intendedDest = Nav_to_start::Navigate($ccDir);

And maybe using modules instead of require() and export the method you
want.

    use Nav_to_start;

    my $intendedDest = Navigate( $ccDir );





-- 
Bill Moseley
moseley at hank.org



More information about the SanFrancisco-pm mailing list