On Thursday 29 Apr 2010, C.DeRykus wrote:
> Um, that won't do what you think. The () just tosses all
> the return arg's and $name remains undefined because
> of the list context.
> 
>   my($name) = () = Function1($arg);  # $name stays undef
> 
> If $name were in scalar context though, you'd get a count
> of the arg's returned and thrown away by ():
> 
>   my $name = () = Function1($arg);   #  count of args to ();
> 
> A couple of other alternatives:
> 
>   my ($name) = Function1($arg);
>   my $name = ( Function1($arg) )[0];

Nice to see all these explanations coming in. Thanks Charles :-)

-- 
Regards,
Akhthar Parvez K
http://Tips.SysAdminGUIDE.COM
UNIX is basically a simple operating system, but you have to be a genius to 
understand the simplicity - Dennie Richie

--
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