Re: [vox-tech] A question of perl style
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [vox-tech] A question of perl style
On Mon, Apr 30, 2001 at 11:25:28AM -0700, Micah Cowan wrote:
> On Mon, Apr 30, 2001 at 11:17:06AM -0700, Jay Strauss wrote:
[...]
> Pretty much, yeah - except that Perl doesn't have pointers. But if
> you meant reference, that's absolutely correct.
>
> In fact, this is always the case, since Perl's definition of an object
> is a reference (any kind, but usually a hashref) that has been
> "blessed" into a class.
Micah pretty much said it. Jay: have you even programmed in C? If you
haven't, you might find that reading up on C and pointers would explain a lot
of the questions you have about perl references.
Pointers are variables that don't hold interesting data, but instead hold the
address in the machine's memory where the interesting data may be found. The
main value in this is that you can (1) dynamically store any amount of data,
limited only by available memory, organized however you like, and (2) you can
pass large chunks of data around without the inefficiency of making a
complete copy.
References in Perl are a safer version of C pointers. While (1) above is a
nonissue in perl, (2) is essential for most serious programming. Hence the
need to use references in Perl.
--
Henry House
OpenPGP key available from http://hajhouse.org/hajhouse.asc
|