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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • d41
    New Member
    • Mar 2008
    • 2

    #1

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

    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:
    Code:
    @classes=("myclass","myotherclass","anotheroneofmyclasses");
    foreach(@classes){new $_;}
    I found you can do this with functions by doing \&functionnam e. 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
    Code:
    $myobject=new someobject;
    Then how do I delete it when I am done with it? Is it ok if I just never delete it?

    Thanks!
Working...