The question has already answered but I thought I would contribute something nonetheless: don't use &subroutine notation anymore, it's antiquated perl and can cause unexpected problems. simply "print doit(*FILE)" as in one of the answers would suffice.