Functions in Powershell are called without any comma or parenthesis, although they are defined using them. The correct way to call a function with two variable parameters would be:
test $local1 $local2
The wrong way is:
If you put parentheses around your parameters, your input is treated as an array and thus the processing might not run as you expect. If you want the input to be an array and to be converted to a string inside the function, use the out-string cmdlet. Type out-string -? for more information.