> I want to send 2 arguments to a subroutine > in the form of arrays I think what you want to use are references. Check out "perldoc perlreftut".
# WARNING: untested code ahead my @a = `/bin/cat /some/file`; my @b = `/bin/cat /another/file`; my @result = addArray([EMAIL PROTECTED], [EMAIL PROTECTED]); sub addArray { my $array1 = shift; my $array2 = shift; my (@res, $counter); # access the whole array by dereferencing (e.g. @{$array1}). # access individual elements through the reference (e.g. $array1->[0]). for (my $i = 0; $i < @{$array1}; $i++) { $res[$counter++] = $array1->[0] + $array2->[0]; } return @res; } I don't know if this is enough to solve your problem though. You might be better off taking a quick look at the reference tutorial I mentioned. Rob -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 8:15 PM To: [EMAIL PROTECTED] Subject: passing arguments to functions Hi all Problem: I want to send 2 arguments to a subroutine in the form of arrays and want to use their result which is also in the form of an array. Explanation: suppose i have 2 arrays @a=`/bin/cat /some/file` ; # A file that has a list of users @b=`/bin/cat /another/file` ; # Another file with a list of users sub try { *&%&^&^&[EMAIL PROTECTED]&(&)(* the code will do some sort of comparison of the elements of both arrays and return the results in the form of an array ........ here i want to return my result in the form of an array say "@answer" } how I can use the resulted array "@answer" in my main program ? Solution: ???? Regards --Bobby -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>