in reply to How to call particular parameter from another configuration file in perl

G'day Prakee,

Welcome to the Monastery.

As I understand it, you have a shell script (CA.sh) that uses a variable (ApID) to return a password. Here's an absolutely minimal script to simulate that:

$ cat ./pm_11133472.sh echo -n "pw$ApID"

Here's a couple of runs. In the first, the script does not have access to the ApID variable and returns a bogus password; in reality, that might be an error message. In the second, the script does have access to the ApID variable and returns a genuine password.

$ ./pm_11133472.sh pw $ ApID=APXD_IERF ./pm_11133472.sh pwAPXD_IERF

Perl has a special variable, %ENV. You can use this to effect what I showed above.

$ perl -e ' for ("", "APXD_IERF") { $ENV{ApID} = $_; my $pwd = `./pm_11133472.sh`; print "$pwd\n"; } ' pw pwAPXD_IERF

How you actually get the value for ApID from the config file is another matter. Others have already commented on that and I really have nothing further to add at this point.

— Ken