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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |