Pass modified filename as argument to user-defined function