note
juanpablo
<p>Hi frozenwithjoy,</p>
<p>Yes, the line 32 is <code>my $conf = "$_";</code>. I've managed to remove the errors but I'm not so sure if this is the correct approach especially the declaration of the same variables under <code>sub add_vhost</code>. What I did was...</p>
<p>remove these variables from above:</p>
<code>
my $conf = "$_";
my $conf_bn = basename($conf);
my $conf_mtime = (stat($conf))[9];
my $date = strftime '%m%d%Y', localtime;
my $backup = "$conf.$date";
my $backup_bn = basename("$conf.$date");
my $ltime = localtime();
</code>
<p>then declared the <code>$conf</code>, <code>$conf_bn</code>, and <code>$ltime</code> variables under <code>sub add_vhost</code>.</p>
<code>
sub add_vhost {
my $conf;
my $conf_bn;
my $ltime;
</code>
<p>and removed the comments from the variables under foreach...</p>
<code>
foreach (@object) {
my $conf = "$_";
my $conf_bn = basename($conf);
my $conf_mtime = (stat($conf))[9];
my $date = strftime '%m%d%Y', localtime;
my $backup = "$conf.$date";
my $backup_bn = basename("$conf.$date");
my $ltime = localtime();
</code>
<p>The errors were gone every time I execute the script. However, after providing two required arguments, the script still does nothing. I was expecting it would start creating a backup of the existing file.</p>
<code>
[root@wsprod01 myperl]# ./test.pl --domain google.com --client google
Usage: ./test.pl --domain companydomain.com --client company [--job-code 12345] [--help].
</code>
<p>Cheers,</p>
<p>JP</p>
1081238
1081240