Hi
All,
A file
containing the following:
$MAINDIR="/usr/local/apps/${APPL}/${ENVR}";
$DBUTILDIR="${MAINDIR}/dbutil";
$OUTDIR="${MAINDIR}/logs";
$LOGDIR="${MAINDIR}/logs";
$BINDIR="${MAINDIR}/bin";
$SQLDIR="${MAINDIR}/sql";
$TMPDIR="${MAINDIR}/tmp";
$SECDIR="${MAINDIR}/secured";
$DBUTILDIR="${MAINDIR}/dbutil";
$OUTDIR="${MAINDIR}/logs";
$LOGDIR="${MAINDIR}/logs";
$BINDIR="${MAINDIR}/bin";
$SQLDIR="${MAINDIR}/sql";
$TMPDIR="${MAINDIR}/tmp";
$SECDIR="${MAINDIR}/secured";
.
.
.
etc...
From a PERL
program I want to read in this file and print out the values of $MAINDIR,
$DBUTILDIR, etc...
I have done
the following, but the output is $MAINDIR, $DBUTILDIR, etc..., instead of the
values.
#!/usr/bin/perl
$APPL
= "sma";
$ENVR = "devl";
$COMMONBIN = "/usr/local/apps/common/devl/bin";
$ENVR = "devl";
$COMMONBIN = "/usr/local/apps/common/devl/bin";
open(FH, "< ${COMMONBIN}/Global_Vars.pl") || die "$!\n";
while (<FH>) {
next if $_ =~ /[#]|^$/;
my ($envVar, $value) = split (/=/,$_);
print STDERR "$envVar\n";
}
while (<FH>) {
next if $_ =~ /[#]|^$/;
my ($envVar, $value) = split (/=/,$_);
print STDERR "$envVar\n";
}
exit;
The output I
want is:
MAINDIR =
/usr/local/apps/sma/devl
DBUTILDIR =
/usr/local/apps/sma/devl/dbutil
OUTDIR =
/usr/local/apps/sma/devl/logs
.
.
.
etc
Please
help.
Peter Loo