put return %enc at the end of your sub.
In reply to Re: passing @ to sub and getting back hash by Joost in thread passing @ to sub and getting back hash by convenientstore