foreach over slica and array and using ref