[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] clearing an array



At 17.47 6/23/97, Gary Ebert wrote:
>> Will the following clear an array totally from memory?
>>
>> %array = ();
>>
>>  or does it just zero all the elements thereof?
>
>I am not sure if that will work or not but you might want to look at the
>undef() function.  I believe that will do what exactly what you want.

Using the debugger you can see that %a=() will remove all elements from %a,
but %a will still exist; undef %a will cause %a to not exist.


Loading DB routines from perl5db.pl patch level 0.94
Emacs support available.

Enter h or `h h' for help.

main::(Dev:Pseudo:2):   %a = (one=>1,two=>2,three=>3);
  DB<1> X a
  DB<2> s
main::(Dev:Pseudo:3):   %a=();
  DB<2> X a
%a = (
   'one' => 1
   'three' => 3
   'two' => 2
)
  DB<3> s
main::(Dev:Pseudo:4):   undef %a;
  DB<3> X a
%a = (
     empty hash
)
  DB<4> s
main::(Dev:Pseudo:5):   sleep;
  DB<4> X a
  DB<5> s

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch