Here while sending data the reference of the array has to be sent .In the receiving end in the function we need to use special form of shift one of the below:
1)my @a = @{shift()};
2)my @b = @{shift()};
Program:
sub myfunc
{
my @a = @{shift()}; # here @{+shift}; can also be used
print "@a";
}
package main;
@aa=("hello","aaaaa");
&myfunc (\@aa); # take care here reference is used.
output:
hello aaaaa
No comments:
Post a Comment