Sign in to follow this  
Followers 0
nobbe

"un-defining" ?

2 posts in this topic

i am searching for a way of easily undefining or "nul"-ling a variable

definition

Perl's undef function

The undefine function (undef) undefines a scalar variable, an array element or an entire array. If you inhale a large table into an array, undef can be used to clear the array and free up system memory. For example:

    open(COUNT,"/path/to/count/file.txt") || die "Can't Open Count Data File: $!\n"; 
    @count = <COUNT>;
    close(COUNT);

    you can later do

    undef (@count);

    to free up memory resources. However

    undef

    is best for undefining a single element of a hash array. For example, if you load $hasharray{'element10'} you can do

    undef $hasharray{'element10'}

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The only way I know of doing that is to use:

$var = ""
Edited by TheCuz

[font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0