in reply to the command - system ( "source ./profile") not working

All the changes made by a shell script will be undone once the process started by system() finishes. Most likely you want to the technique outlined in Get default login environment if you need to set up a runtime environment of a shell script from within Perl.