--- Etienne Marcotte <[EMAIL PROTECTED]> wrote: > This is a very newbie question.. > > When sending arguments to a sub, is it preferable to send a pointer to > this value or the value itself. Or after x arguments it's better to send > references? > > Etienne
Etienne, I think Brett W. McCoy gave an excellent answer to your question. I just have one point to clarify: in Perl, we do not have pointers (the analogue is called a reference) in the sense that you might see them in C. For example, in C, you can directly manipulate the value of a pointer to access other areas of memory. This is not possible in Perl: my @array = qw/ 1 2 3 4 /; my $scalar_ref = \$var; $scalar_ref++; # WRONG! Example of output: C:\>perl -e "$z=[qw/1 2 3 4/];print $z" ARRAY(0x1a7f018) C:\>perl -e "$z=[qw/1 2 3 4/];print ++$z" 27783193 I assume you know this, but I thought I would toss that out there, in case you weren't. Cheers, Curtis "Ovid" Poe ===== Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __________________________________________________ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]