Rob Dixon wrote:
> 
> Joseph wrote:
> >
> > "John W. Krahn" wrote:
> > >
> > > If you want to clear out the hash completely then:
> > >
> > > %hash = ();
> > >
> > > Will remove all the keys and values from the hash.  This will also work
> > > with a hash of hashes.
> > >
> > > Or if you need to reinitialize it you can just assign the key/value
> > > pairs to the hash:
> > >
> > > %hash = ( newkey1 => 'newval1', newkey2 => 'newval2' );
> > >
> > > Which will assign the new list, replacing anything that was in there
> > > before.
> >
> > That indeed is one of the conveniences that makes one truly appreciate the
> > beauty of Perl reference-counting, anonymous data structures, and the use of
> > references.  Makes cleanups fast and easy.
> 
> I agree with your point, but there's no reference counting involved here
> (unless the hash values were themselves references).

AFAIK all variables have a reference count.

$ perl -e'
use Devel::Peek;
    $c = 1;        Dump $c;
our $d = 2;        Dump $d;
my  $e = 3;        Dump $e;
    @f = 4;        Dump @f;
    %g = ( 5, 6 ); Dump %g;
'
SV = IV(0x8100f30) at 0x810a968
  REFCNT = 1
  FLAGS = (IOK,pIOK,IsUV)
  UV = 1
SV = IV(0x8100f34) at 0x810a8b4
  REFCNT = 1
  FLAGS = (IOK,pIOK,IsUV)
  UV = 2
SV = IV(0x8100f38) at 0x810da98
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,IOK,pIOK,IsUV)
  UV = 3
SV = IV(0x8100f3c) at 0x80f47a0
  REFCNT = 1
  FLAGS = (IOK,pIOK,IsUV)
  UV = 4
SV = PV(0x80f4a6c) at 0x80f46b0
  REFCNT = 1
  FLAGS = (TEMP,POK,pPOK)
  PV = 0x8104030 "5"\0
  CUR = 1
  LEN = 2




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to