Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global sub not found in local package?? 1

Status
Not open for further replies.

Nebbish

Programmer
Apr 7, 2004
73
US
k Gurus, this is driving me crazy. Perhaps there is an obvious, logical explanation for this but I don't see one. I have a script:

Code:
sub myFunction {
  print "hello.";
}

{ package myPackage;
  myFunction();
}

Says it can't find the function myPackage::myFunction. MAIN::myFunction doesn't work either, when I try that instead. Is there any way to define a function that will work anywhere, including packages? I know if I manually import myFunction to the package it'll see it, but I'd rather not have to do that every time. Thoughts?

-Nick
 
main::myFunction rather than MAIN ?

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top