in reply to Clearing a namespace

once the namespace has gone out of scope, the variables are all cleared. if you're talking about CGI scripts, Perl's internal garbage collection cleans out the namespace when the script exits ( since all variables have gone out of scope, i.e. no references to them.)

i've always just used  undef $foo when i've needed to explicitly blow away an instance of a variable.

you can always just re-assign values. coding  $foo = 'blalal'; after $foo gets a value is appropriate.

if you need to blow away a namespace in the middle of a script i suspect there's something lacking in the design ( esp. if variable re-assignment doesn't fit the task).

UPDATE: merlyn has corrected me on terminology. namespaces don't go out of scope. variables in a namespace go out of scope.

Replies are listed 'Best First'.
RE: RE: Clearing a namespace
by merlyn (Sage) on Oct 04, 2000 at 03:19 UTC
    A namespace doesn't "go out of scope" though. The original poster seems to want to clear out some package before the script is over.

    My simple advice: don't use the feature if you need to reuse the namespace.

    -- Randal L. Schwartz, Perl hacker