Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Variables and Scope: The battle begins

by educated_foo (Vicar)
on Dec 12, 2013 at 06:21 UTC ( #1066766=note: print w/ replies, xml ) Need Help??


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?


Comment on Re^2: Variables and Scope: The battle begins
Re^3: Variables and Scope: The battle begins
by GrandFather (Cardinal) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1066766]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2014-12-22 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (112 votes), past polls