Could adding an evaluation to the end of the sub something like;
sub gettinglist{
$ListItemReturnedCount++ if { Item retrieved };
return $ListItemReturnedCount;
}
be a possible alternative? Ok, perhaps if you are debugging but not for production as a very unexpectedly short list would be returned to a calling routine somewhere. So, seeing as the sub is returning a list anyway. Could you not retrieve the number from some other place, for example from the sub/routine to where the list is called from?