In reply to overload.pm is perfect for the job by FutureBoyNil in thread return Both ARRAY and SCALAR by FutureBoyNil