[sf-perl] Scope of a variable

nheller at silcon.com nheller at silcon.com
Thu Mar 8 15:49:53 PST 2007


I ended up returning the value I wanted and it worked fine.
I suppose that in the future, if I want to return more than one simple
value I should return an array or hash.  My question turned out to be more
theoretical than real.

Another question I have: can you tell me an efficient way of calling a
module other than "system"?



> 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
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>



More information about the SanFrancisco-pm mailing list