On Thursday 29 Apr 2010 14:31:38 Akhthar Parvez K wrote:
> Hi,
> 
> The following line stores the first return value by the function Function1
> to the variable $name:
> 
> my ($name) = @_[0] = &Function1 ($arg);
> 

Why are you assigning to variables inside @_? It's almost always a bad idea.

@_ is the function parameters' list. You should read the values from there 
(using "my ($param1, $param2, $param3) = @_;" or "my $param1 = shift;" (short 
for "shift(@_)")) and then possibly mutate them if they are references and 
return values from the function using return. But don't assign to @_. You can 
use a lexical array variable with any name you want as an alternative if you 
need to use an array.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"The Human Hacking Field Guide" - http://shlom.in/hhfg

God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to