made this perl script more simple and took away usless varibles