in reply to Method for sharing variables

I am wanting to beable to share certain global variables between the interface and the various scripts...

I think you'll need to clarify what you mean by that?

  • How are you running the "various scripts"?

    Is it your intention that these will be separate scripts invoked through system, backticks or similar means?

  • When you say "share", do you mean mono-directionally between the parent (tk) script and a the subordinate scripts?

    If so, passing the value in via the command line involation would work. Or you could set them into %ENV prior to the invokation and they will be available in the called scripts %ENV.

    Return values from invoked scripts could be retrieved using backticks.

    There are several other interpretations of you question ranging from invoking the "scripts" via do, where they would have automatic access to any existing global data within the calling script, to writing your sub-scripts as proper modules.

    Your clarification will probably elicit better answers.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
  • Replies are listed 'Best First'.
    Re^2: Method for sharing variables
    by Anonymous Monk on Oct 04, 2005 at 04:40 UTC
      Recently I wrote a module ( with plenty of help from monks ) that read in a file that created variables consistently for each user. I created a file that has var=value pairs and set them each time a script was run. $ENV{'variable'} is your friend.