Call .profile in perl script

Hello Gurus

Can anyone please let me know how to call .profle file in perl script
When I am calling the .profile file its giving error

Shall I create unix script which has .profile command and call perl script internally

.profile is a shell script, shell scripts don't run in perl.

Creating a shell inside perl to run .profile in is pointless, environment variables don't work that way. The script and anything the script runs would get the vars, but perl wouldn't. Children get copies of your environment, parents don't get environment variables from children.

You should source .profile in a shell, and have that shell run the perl script. The perl script will inherit the vars from it.

Hi Corona688

Thanks for the insight
I created one unix script ,called the .profile from there and then call the perl script
It worked:)