in reply to How to return multiple array from subroutine

Hi,

If you need to return multiple array,you should return the array by reference and in the calling place you have to de-reference it and use.otherwise the boundary may be getting collapsed and the whole array contents will be available in the first array itself.The below code will work fine,
sub breakEmailAddress { my ($address) = shift(@_); @components = split('@', $address); @counter = split('@',$address); return (\@components,\@counter); } ($first,$second) = &breakEmailAddress('john@some.domain.com'); print"FirstArr=>@$first\n"; print"SecondArr=>@$second\n";
Thanks and Regards,
madtoperl.