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
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
&
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
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
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;
> 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
Hi All,
Wondering if someone can give me a shortcut for the following..
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
assigning them to inter