nobbe Posted July 5, 2008 Share Posted July 5, 2008 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'} Link to comment Share on other sites More sharing options...
TheCuz Posted July 5, 2008 Share Posted July 5, 2008 (edited) The only way I know of doing that is to use: $var = "" Edited July 5, 2008 by TheCuz [font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now