Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Importing vars from one script to another

by BillKSmith (Vicar)
on Dec 11, 2012 at 23:03 UTC ( #1008419=note: print w/replies, xml ) Need Help??

in reply to Importing vars from one script to another

Your 'constants' are not constants at all, but normal global variables. They should work as shown. In order to satisify warnings, I had to add a use Lib '.'; to your main script to let perl find the file. I also had to add a final 1 to the file.

I recommend using the Readonly module to make all the constants truly constant.


Replies are listed 'Best First'.
Re^2: Importing vars from one script to another
by edbewald (Beadle) on Dec 11, 2012 at 23:52 UTC

    That did it! I thought I had tried everything but I was missing the '1'. Now it works.

    And I agree 100% that these are hardly constants. I usually use Readonly module for that and will do so with this.

    Thanks for all the answers everyone gave. I really appreciate it

      That did it! I thought I had tried everything but I was missing the '1'. Now it works.
      Whatever was the reason, this one can't be it.

      If you require a file, the last expression in the included file must return a value which evaluates to true, otherwise your program dies. Therefore: If you had a value which evaluated to false in your earlier version, your program would not have executed, and you would have got an error message pointing out the problem. But if it already evaluated to true in your earlier version, adding a 1 doesn't change anything.

      Ronald Fischer <>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008419]
[Corion]: marto: Oooh - cinema... I guess that's something I could do with my godson and sibling and sister as well, but I guess that getting a six year old and two four year olds into one movie is a tough sell ;)
[marto]: busy weekend, no me time :P
[Corion]: marto: Yeah, that's somewhat implied :) I was on the phone with my godson yesterday (they birthday), but I haven't seen them for two weeks now (vacation), relaxing, but I somewhat miss them too ;)
[Discipulus]: me waterpolo? oh no! i'm a no sport; the tournment was for the elder son
[karlgoethebier]: good morning
[Corion]: Discipulus: Ah, so he's the one getting almost drowned all the time - waterpolo certainly is no sport for me ;)
[karlgoethebier]: Corion: buy enough coke and popcorn...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2017-07-24 08:14 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (348 votes). Check out past polls.