I think the line:
reply_multi( \$daemon{xmpp_o}, \($adminuser{fromJID}, $fromJID), "blah" );
should have \(...) replaced with [ ... ] :
reply_multi( \$daemon{xmpp_o}, [$adminuser{fromJID}, $fromJID], "blah" );
because
\('foo', 'bar')
evaluates to
(\'foo', \'bar')
Does that clarify this for you?
Andrew
On Sat, Jan 13, 2024 at 2:51 PM hw <[email protected]> wrote:
> Hi,
>
> how do I pass an array that is created on the fly as one parameter of
> a function?
>
> Example:
>
>
> use feature 'signatures';
> no warnings 'experimental::signatures';
>
> sub reply_multi ( $xmpp_o, $rcpts, $msg ) {
> foreach my $rcpt (@$rcpts) {
> $$xmpp_o->MessageSend( type => 'chat', to => $rcpt, body => $msg );
> }
>
> return;
> }
>
> reply_multi( \$daemon{xmpp_o}, \($adminuser{fromJID}, $fromJID), "blah" );
>
>
> This gives me an error at runtime: "Too many arguments for subroutine
> 'main::reply_multi' (got 4; expected 3)".
>
> Yeah, sure, ok, but is that even right? Or is signatures too
> experimental to handel that yet? Or how do I do what I want here?
>
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>