Your:
@{${mySub()}[1]}
is placing the mySub() in a ${ ... }[ ... ]
, which expects an array reference to look up an element of, as if you had returned [ \@array1, \@array2 ]
from your subroutine. You can find some helpful hints to think about how to deal with data structure references at http://perlmonks.org/?node=References+quick+reference.
In your case, you want to use a list slice, not an array element lookup, to get the arrayref you want to then dereference:
@{ ( mySub() )[1] }