This might seem like a stupid question but it’s been a long day. I’m an adapting some Perl code for another use and I ran across this syntax:
my @request;
#... fill the array with stuff...
my $reply = $service->call('requestMessage' => @request, $header);
That method call seems implausible, if => is just a special kind of comma and @request gets interpolated into the list.
Is it actually equivalent to:
my $reply = $service->call('requestMessage' => \@request, $header);
What’s going on here?
EDIT: Thanks for the answers. I am well aware of the difference between pass by value and pass by reference. I was asking if an apparent pass by value was being converted into a pass by reference. Apparently not. Thank you all for answering.
The code in question:
is not equivalent to this:
It is, as you surmised, equivalent to this:
Sometimes, the “fat comma,” as
=>is known, is used to indicate a relationship between positional parameters. For example, the link between the method namesome_methodand its intended@argumentsin this code: