Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

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"; }


    <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"; }


    <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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (1)
As of 2021-10-19 19:24 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (77 votes). Check out past polls.