in reply to Re^2: I'm getting some weird error
in thread I'm getting some weird error

You called your subroutine, and then tried to call its result again, as a subroutine:

&$subref; # this calls the subroutine &$subref->(); # this calls the subroutine and tries to call the result + again, as a subroutine

Using & is a bad idea in most cases.