http://qs321.pair.com?node_id=1066766


in reply to Re: Variables and Scope: The battle begins
in thread Variables and Scope: The battle begins

How do any of those things you mention help the OP?

Replies are listed 'Best First'.
Re^3: Variables and Scope: The battle begins
by GrandFather (Saint) on Dec 12, 2013 at 07:57 UTC

    For the OP's immediate problem it's likely they don't. However the type of issue the OP is having leads me to think that the OP hasn't wide programming experience so pointing out areas that are a frequent cause of subtle problems may help. For example the & calling convention leads to

    doit(1, 2, 3); againSam(1, 2, 3); sub againSam { andAgain(); andAgain(); } sub doit { &andAgain; &andAgain; } sub andAgain { my (@values) = @_; print "<@values>\n"; }

    printing:

    <1 2 3> <1 2 3> <> <>

    which may be surprising if you don't appreciate what &andAgain is doing. Mixing prototypes in may also be surprising:

    sub andAgain ($); my @nums = (1, 2, 3); andAgain(@nums); &andAgain(@nums); sub andAgain ($) { my (@values) = @_; print "<@values>\n"; }

    prints:

    <3> <1 2 3>

    I doubt either "issue" is what is troubling the OP currently. However & call usage at least is present in the OP's code and where there is & calling there are likely prototypes. Pointing out potential problem areas in the OP's code, even if it's not what the OP is asking about, helps the OP. Until the OP shows us some code that reproduces the actual problem the best we can do is offer help with a few style issues.

    Note, the example code really isn't for educated_foo whom I'm sure knows all about this stuff. The examples are for those who are wondering what the fuss is about. Oh, and strictures are always useful, at the very least to pick up typos and brain farts.

    True laziness is hard work