Re: lambda array

2024-01-13 Thread Ken Slater
On Sat, Jan 13, 2024 at 12:41 PM Andrew Solomon wrote: > > when is an array in perl declared with [] instead of ()? > > Using the [ ] delimiters you are creating a *reference* to an array. > (Think of a reference as the memory address where the array is stored). So > > my $foo = [1,2,3]; > > is e

Re: lambda array

2024-01-13 Thread Andrew Solomon
> when is an array in perl declared with [] instead of ()? Using the [ ] delimiters you are creating a *reference* to an array. (Think of a reference as the memory address where the array is stored). So my $foo = [1,2,3]; is equivalent to the following, because given an array the \ gets the refe

Re: lambda array

2024-01-13 Thread hw
On Sat, 2024-01-13 at 15:00 +, Andrew Solomon wrote: > 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 >

Re: lambda array

2024-01-13 Thread Andrew Solomon
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

lambda array

2024-01-13 Thread hw
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 => $rc