RE: How to pass two arrays as arg in a subroutine?

2004-08-05 Thread kamal.gupta
Hi, Whenever you pass two arrays (or any number of arrays for that matter) as arguments to a function, what happens is they get flattened and become a single list and then it is assigned to @_. So when U say > > my (@array1, @array2) = @_; # is this correct? How do I do it? > @array1 has

Re: How to pass two arrays as arg in a subroutine?

2004-08-05 Thread WilliamGunther
Have them pass the arrays as a reference. For example: @array1 = (1, 2, 3, 4, 5); @array2 = (6, 7, 8, 9, 10); mysub([EMAIL PROTECTED],[EMAIL PROTECTED]); sub mysub{ my ($array1, $array2) = @_; #process @{$array1} #process @{$array2} etc return @array3; } Look into perl

Re: How to pass two arrays as arg in a subroutine?

2004-08-05 Thread Edward Wijaya
Thanks so much Kamal, your explanation is very clear and complete. It works now. I learnt a great deal from it. Regards Edward WIJAYA Hope this is useful for you. For more on references go through "perldoc perlref" With Best regards, R. Kamal Raj Guptha. -- To unsubscribe, e-mail: [EMAIL PROTECTE