By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,852 Members | 1,426 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,852 IT Pros & Developers. It's quick & easy.

Store package(class) name in a variable, and remove an instance of a package

P: 2
Hello. I have 2 (probably simple) perl questions.

1. I want to store a package (or class) name in a variable. How do I do this? I want something like this:
Expand|Select|Wrap|Line Numbers
  1. @classes=("myclass","myotherclass","anotheroneofmyclasses");
  2. foreach(@classes){new $_;}
I found you can do this with functions by doing \&functionname. Is there a similar way to do this for package names?

2. After I create an instance of a package, how do I remove it? If I have something like
Expand|Select|Wrap|Line Numbers
  1. $myobject=new someobject;
Then how do I delete it when I am done with it? Is it ok if I just never delete it?

Mar 19 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.