perl code for cqs data analysis