Jano Svitok
11/6/2007 10:51:00 AM
On 11/6/07, Mario Ruiz <mario@betware.com> wrote:
> I'm trying to pass to a method all the parameters in a global variable:
>
> $allparameters="dos","ie","4","alone","","8"
>
> ...
>
- myclass.mymethod($allparameters)
+ myclass.mymethod(*$allparameters)
>
>
> I'm doing that because I'm using this parameters a lot.
> The error is: wrong number of arguments (1 for 6) (ArgumentError)
>
> I tried also: $allparameters=["dos","ie","4","alone","","8"]
The "splash" operator * sort of "expands" the contents of the array.
Note that it's better to avoid global variables if possible.
J.