Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Variables and Scope: The battle begins

by GrandFather (Saint)
on Dec 12, 2013 at 07:57 UTC ( [id://1066774]=note: print w/replies, xml ) Need Help??


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

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1066774]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found