No luck. I tried with ./ and specifying full path. Getting the same error message.
I need to do a lot of string manipulation before setting these 2 environment variables. I feel more comfortable with perl than shell scripting. That is the reason behind using perl here.
Your PERL program inherits its environment from the SHELL that spawned it, changing environment variables will only last for the duration of the PERL program.
At the shell prompt, if you echo $ORACLE_SID and $ORACLE_HOME, do you see any values? If you want to set these two environment variables, perhaps you should set them from your profile instead.
Great, but you can't source a Perl script into a Bash / Ksh, etc. environment.
Perhaps an alternative, if you're more comfortable in Perl is to do the string manipulation there, and then print the values. Then, the shell can be used to set them.
echo $ORACLE_SID and $ORACLE_HOME is showing blanks.
I can't set this in the .profile because I keep executing the script by passing a parameter and this perl script should set the env variables based on the parameter.
It has to be run inside your current shell in order to successfully set environment variables. This means your perl script will never work -- even if perl runs, your perl interpreter will have its own separate environment and the changes won't happen in your own shell.
Fortunately it's extremely easy to convert this script into a generic shell script.
You will need to have the script execute the necessary program inside it then, so it can export things the way you want them, then launch the program with the updated environment.