Thank you so much for replying.
Currently i have access to a CQWeb server which happens to ask me to login and only then I can run a query.
I have broswed the web for 3 continous days for something to help me with this however couldnt find any scripts for cqweb in perl.