Pointers (in C) and references (in Perl) are mostly the same, and they can be used for speeding up stuff in the same manner in both languages. A reference allows you to pass data to a subroutine without copying that data into separate memory - this is where you can gain speed if your data is big and does not need to be copied.

References can also be used for most of the scary stuff that comes from the good ole time when an int was a pointer and a pointer was an int (and with 32-bit machines, this time has returned) - you can have references to subroutines etc. - and also here, it might be faster to call a reference to a subroutine instead of going through a map or some other way of decision making.

About the only thing that can't be done with references is C-style pointer arithmetic, but that's mostly needed for string manipulation - and Perl has its own set of commands, operators and functions for string manipulation derived from utilities better suited at string manipulation than C :).

DISCLAIMER: The author has never written a line of C and refuses to take any responsibility for failure of analysis and existence of working code before optimizing stuff for any dimension. Always benchmark !

In reply to Re: Whats a da pointer? I know what my (p)references are. by Corion
in thread Whats a da pointer? I know what my (p)references are. by frankus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.