Perl does not have nested functions. Note to self: do not program while this tired.