Perl imposes are no limits on any variables other than the available memory. Try adding a few
prints in there, right after you read a line, before you call the function, after, and so on. I suspect it is the function you call that for some reason chokes on input larger than 44k; by adding
prints you'll be able to verify at which point in time exactly things go awry.
Makeshifts last the longest.