See Overriding core functions.
In reply to Re: Tie subroutine to a built-in function call? by BrowserUk in thread Tie subroutine to a built-in function call? by bcarroll