tfoertsch has asked for the wisdom of the Perl Monks concerning the following question:

I need to delete a package and free all resources bound to it. How can that be achieved?

I can create a new package by simply placing variables in it:

$X::Y::a=1; sub X::Y::f {}
creates a package with 2 elements. But:
delete $X::{"Y::"};
does not show the desired effect.

Replies are listed 'Best First'.
Re: How to delete a package
by zentara (Cardinal) on Jun 19, 2008 at 13:17 UTC
    There is a faq for that... "perldoc -q clear".

    I'm not really a human, but I play one on earth CandyGram for Mongo
Re: How to delete a package
by Anonymous Monk on Jun 19, 2008 at 12:03 UTC
Re: How to delete a package
by jds17 (Pilgrim) on Jun 19, 2008 at 12:05 UTC
    The no function, see the perldoc entry no should do the trick.

    Update: Please ignore this post, sorry. "no" is just the opposite of "use", so it won't free up anything outside the package where no is being used. Please refer to the previous post for answers to your question.

      Nope :) all no does is call unimport
      C:\>perl -MCGI -le"no CGI; print CGI::header()" Content-Type: text/html; charset=ISO-8859-1