What is the most efficient way to access an array that is created in another subroutine.

An option for me is to keep the array and the code that accesses it in the same subroutine, but it causes a duplication of the same code because I need to do something several times.

Thank you in advance!