The reason for the embedding of the subroutine within the code at this point is so that the regular expressions in the file are loaded entirely within the BEGIN {} block. Yes I can still call the subroutine from this point, but for my own mindset, I like keeping such initialisation code in the one place.
You could put the sub definition in the BEGIN block...