Almost finished perl script for profiles