RE: dereferencing a array element reference

2002-10-18 Thread Jeff 'japhy' Pinyan
On Oct 18, HENRY,MARK (HP-Roseville,ex1) said: >Huh, so pointers with the purpose of modifying the original data are not >necessary in perl? > >Why then would you use references (apart from the performance of passing >large amounts of data by value)? > >For larger & more data structures? It's bet

RE: dereferencing a array element reference

2002-10-18 Thread HENRY,MARK (HP-Roseville,ex1)
Message- > From: Jeff 'japhy' Pinyan [mailto:japhy@;perlmonk.org] > Sent: Thursday, October 17, 2002 10:35 PM > To: HENRY,MARK (HP-Roseville,ex1) > Cc: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' > Subject: RE: dereferencing a array element reference &

Re: dereferencing a array element reference

2002-10-18 Thread Jeff 'japhy' Pinyan
On Oct 17, HENRY,MARK (HP-Roseville,ex1) said: >I'm passing a few variables into a function, and I want to be hip so I send >them in as references.. > >my_function (\$var_1, \$var_2); You really don't need to, but ok. >print "var 1 is $$_[0] and 2 is $$_[1]"; > >This doesn't work, but you get th

Re: dereferencing a array element reference

2002-10-18 Thread Jenda Krynicky
From: "HENRY,MARK (HP-Roseville,ex1)" <[EMAIL PROTECTED]> > I'm passing a few variables into a function, and I want to be hip so I > send them in as references.. > > my_function (\$var_1, \$var_2); > > Now, within the function, can I dereference them immediately? I've > assigni

RE: dereferencing a array element reference

2002-10-18 Thread Jeff 'japhy' Pinyan
On Oct 17, HENRY,MARK (HP-Roseville,ex1) said: >> You really don't need to, but ok. >> >This depends on whether I want to modify the passed in variable.. (as well >as to be hip :) You can modify variables sent to a function by modifying @_ by index: sub foo { $_[0] += 2; } $r = 13;

RE: dereferencing a array element reference

2002-10-18 Thread HENRY,MARK (HP-Roseville,ex1)
> You really don't need to, but ok. > This depends on whether I want to modify the passed in variable.. (as well as to be hip :) > >print "var 1 is $$_[0] and 2 is $$_[1]"; > > > >This doesn't work, but you get the idea... > > That's because the $ binds to the $_, and not to the $_[0]. You wa