On Mon Jun 22 2009 @ 11:10, Steve Bertrand wrote: > I've got a relatively decent understanding of how references work in > Perl (syntax-wise, especially when/how to de-ref), but I'd now like to > ask when to use them. > > Obviously memory allocation isn't an issue anymore, so when exactly > should refs be used, and in what circumstances shouldn't they be used?
I'm not quite sure what you mean by "memory allocation isn't an issue anymore." Do you mean "With modern hardware, who cares about memory saving?" If so, I don't know that I would go that far. Premature optimization may be evil, but copying huge arrays and hashes just for fun seems silly, too. So, I do use references when passing arrays or hashes to functions or returning them from functions. More generally, references are essential for complex data structures. My favorite brief introduction to references comes at them from that angle: perldoc perlreftut You might also take a look at two other tutorials in perldoc: perldoc perllol perldoc perldsc Enjoy, T -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/