Hi Everyone,
There is a perl file: a.pl
============
#!/usr/bin/perl
my $config_file = $ARGV[0];
open CONFIG, "$config_file" or die "Program stopping, couldn't open the configuration file '$config_file'.\n";
my $config = join "", <CONFIG>;
close CONFIG;
eval $config;
die "Couldn't interpret the configuration file ($config_file) that was given.\nError details follow: $@\n" if $@;
print $home_dir;
==============
the conf file: a.conf
=================
#-------------------------#
$home_dir = `cat /etc/passwd | grep root | cut -f6 -d':' | tr -d '\n'`;
So i run: a.pl a.conf, so i can easy get the output "/root".
From this a.pl. there is no way to write to the a.pl, like change the value of $home_dir?
Please advice. Thanks
I think i wil drop this method to read and write conf file, becuase if i use
use strict;
use warnings;
in the a.pl,
then fail.