Re: Clear a hash

2008-01-29 Thread Chas. Owens
On Jan 29, 2008 1:26 AM, Andrew Limareff <[EMAIL PROTECTED]> wrote: > Chas. Owens wrote: > > > You initialize a hash with a list. So if you want an empty hash then > > you need to assign an empty list to it: > > > > %hash = (); > > > > Couldn't you go > > undef( %hash ); > > to get an undefined re

Re: Clear a hash

2008-01-29 Thread Andrew Limareff
Chas. Owens wrote: You initialize a hash with a list. So if you want an empty hash then you need to assign an empty list to it: %hash = (); Couldn't you go undef( %hash ); to get an undefined ref - leaving the old contents for the system to free up? -- To unsubscribe, e-mail: [EMAIL PR

Re: Clear a hash

2008-01-18 Thread Aaron Priven
I think you want %hash = (); which will make sure there are no elements in %hash. Your statement was %hash = {}; In this case, the {} will return a reference to an empty hash, and the assignment will then attempt to make this reference into a key in %hash. Since hash keys can only be stri

Re: Clear a hash

2008-01-18 Thread Chas. Owens
On Jan 18, 2008 11:57 AM, Kevin Viel <[EMAIL PROTECTED]> wrote: > Is there a way to empty/clear a hash in mass? > > For instance: > > %hash = {} ; > > > Might the above create an reference? snip The above does create a reference. In fact, the hash will now contain something like %hash = ( "H

Re: Clear a hash

2008-01-18 Thread yitzle
See http://perldoc.perl.org/functions/delete.html Generally speaking (ie yes, there are exceptions), there is no reason to ever want to delete a variable. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/