in reply to Re^2: How to pass array literal through pass by reference
in thread How to pass array literal through pass by reference
Please read the link I provided you (perlref) as it discusses anonymous arrays. A look through perlreftut would also likely do you some good.
No matter what you do in Perl, arguments are always passed as an explicit list of values, just like in C. In passing by reference, you are really passing a pointer to an array. You can generate such a pointer with the \@array syntax that you used in your example code (also discussed in perlref). The syntax [1, 2, 3] returns a pointer to an array (1,2,3). That array has no symbolic representation within your namespace, and is thus "anonymous".
So the short answer is that the syntax
WriteToFile( ["abc", "23343"] );
passes a reference to an array containing ("abc", "23343") to the subroutine WriteToFile.
|
|---|