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

Thank you for the fast reply.
1) I always use strict and warnings. :)
2) All my subs are called with arguments, so the ()'s are always there, but given that I just saw the difference clearly delineated for me, I will remove the &'s in my code and see if that changes. THank you.
3) I had to google what a subroutine prototype was. I can tell you with certainty that I have none of those. :)
  • 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 18:40 UTC
    All my subs are called with arguments, so the ()'s are always there

    Actually, no they aren't ;). Your code includes &getinput; and &status calls without arguments at least. Just goes to show how easy it is for code not to be the way you think it is!

    If you haven't resolved the issue yet you should try to strip out code until you find the problem or you have a sample script with a minimum of irrelevant code and still demonstrating the issue. You may find I know what I mean. Why don't you? helps focus your effort.

    True laziness is hard work
      You are right, neither of those have arguments. status neither takes any nor returns any, it just prints the status of several variables. getinput returns an argument (the input). Neither affect global variables.
      However, you are right in that code can often be misleading. I have stripped all the &'s from my code and confirmed that it still functions like I expected it to. I have yet to try again with global vars, so we will see how that goes.