--- David Simcik <[EMAIL PROTECTED]> wrote:
> Hello,
>       This is a newbie question if there ever was one, but what is the difference
> between a (Perl) reference and a (C/C++ style) pointer??? The only thing
> that seems immediately obvious is that C/C++ pointers are strongly
> typed...???
> 
> 
> Hmmm.
> DTS

David,

In C (and I assume C++), pointers specifically point to the memory location of the 
data you are
looking for.  If you wanted to, you could increment or decrement that pointer value 
directly to
access different areas in memory.

In Perl, we use references that tell Perl where in the symbol tables and scratch pads 
(where info
on lexically typed variables is stored) to find the data in question.  A reference in 
Perl will
also have information regarding the type of data to which it is pointing.  This is 
useful if you
need to know this information:

    perl -e '$x=\%y;print ref $x'

That will print "HASH".  However, I just list that as a side note.  Most programs that 
use 'ref'
have problems that a programmer hacked his or her way around by using 'ref'.  That's 
not to say
that ref has no use, it's just often used innappropriately.

For more information on references, see "perldoc perlref".

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. 
http://im.yahoo.com

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

Reply via email to