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

Re: [MacPerl] ARRGH! no more



kmcgill@peachnet.campus.mci.net (Ken McGill) writes:
>I have yet to see any information about pointers.  Are there
>C like pointers in PERL?

There are "references" which serve the role of "something that points *to*
another object". The C pointer role of "something that points *into* another
object" has no equivalent.

C:                     Perl:
int a[] = {1, 2, 3};   @a = (1, 2, 3);
int * b = a;           $b = \$a;
int c = b[0];          $c = $b->[0]; # Or $c = ${$b}[0]

but there is no equivalent for

int * d = a+2;

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
  "And that's why I am going to turn this world upside down, and make
   of it a fire so *bright* that someone real will notice"
                                -- Vernor Vinge, _Tatja Grimm's World_