Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Calling a Variable from another file

by tlm (Prior)
on Jun 22, 2005 at 13:47 UTC ( [id://469015]=note: print w/replies, xml ) Need Help??


in reply to Calling a Variable from another file

I've never actually done what I'm about to propose, so there may be pitfalls I haven't thought of, but assuming that the assignment to my $res is the last executable statement in mydata.pl, I would try something like

my $whatever = do 'mydata.pl';
That should be equivalent to assigning to $whatever the value returned by eval'ing the contents of mydata.pl.

I question the whole approach on design grounds, however. See this thread for some possible alternatives.

the lowliest monk

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2024-04-18 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found