RE: Pointers

From: Paul Kraus (pkraus_at_pelsupply.com)
Date: 11/20/03


To: "'Eric Walker'" <ewalker@micron.com>
Date: Thu, 20 Nov 2003 14:23:43 -0500

Forget about references for a minute.

%hash <- refers to the entire hash.

$hash{key} refers to one element of that hash.

So as a reference you would address the entire hash as %$hashref
Or a single element of that hash as $$hashref{key}

HTH
Paul

-----Original Message-----
From: Eric Walker [mailto:ewalker@micron.com]
Sent: Thursday, November 20, 2003 2:20 PM
To: Paul Kraus
Cc: 'perlgroup'
Subject: RE: Pointers

ok why the $$ instead of the %$?

sorry confused.

On Thu, 2003-11-20 at 12:08, Paul Kraus wrote:

    $$overdate{key}
    
    Perldoc perlref
    
    -----Original Message-----
    From: Eric Walker [mailto:ewalker@micron.com]
    Sent: Thursday, November 20, 2003 2:03 PM
    To: perlgroup
    Subject: Pointers
    
    
    Hello all, newbie here got a few questions:
    I am working with pointers and I sort of understand them and then I
    don't. I understand that instead of making a variable for a
particular
    value you can use a pointer to access the same data. So the new
    variable stores the pointer to the old data. ie.... $a = "mom";
          $b = \$b;
    print $$b --> mom
    
    Ok so what I don't understand is when do I need to dereference the
    pointer for hashes. so I have a hash pointer.. \%overData. Now
how do
    I access this hash. %$overData?
    
    Thanks
    confused.
    newbie
    
    
    
    



Relevant Pages

  • Re: Passing hashes to a function
    ... you are only copying the overall hash. ... you are copying the ... you are copying the references. ... You are here modifying the value that $aarefers to. ...
    (comp.lang.perl.misc)
  • Re: References - problem understanding them
    ... just the pointer to that gone hash. ... I guess I'm wrong in understanding references as pointers like they are ... You essentially have no access to the stack at all in Perl. ...
    (comp.lang.perl.misc)
  • Re: transport a C pointer through Tcl
    ... Andreas Otto wrote: ... I've taken a different approach lately with extension pointers. ... In other words I store an int offset in each Tcl_Obj, ... It's also faster than Tcl's hash table, ...
    (comp.lang.tcl)
  • Re: Suggestions for double-hashing scheme
    ... > The items that are being moved are the items in the hash table itself, ... The hash table array would store, eg, a pointer to the memory ... on allocating enough space to store data elements of any size. ... Additionally storing pointers to them would make me incur the charge twice. ...
    (comp.programming)
  • Re: Suggestions for double-hashing scheme
    ... assuming pointers are the values being ... If we wanted to do an in-place move in the hash, ... itself, which are of fixed size (they are in an array, after all). ...
    (comp.programming)