A quick search for
shared on the sites lists among the results the thread
mod_perl: variable $end will not stay shared (nested subroutines problem). In short, you should declare that variable with use vars instead of my. Apache caches your script by wrapping the whole thing in a subroutine, which causes problems when you declare lexical variables in the main part of the script and then use them inside one of your subroutines.
You haven't showed us how you defined the subroutine sendData, but apparently you gave it a prototype that specifies fewer arguments than you're calling it with. You may have done sub sendData () {} when you meant sub sendData {}.