Ah, never have truer words been spoken! You'd think I'd've learned that by now... :)
Here are the errors I'm seeing:
$ perl makeconfig.pl < host-ip.csv
syntax error at makeconfig.pl line 14, near ") {"
syntax error at makeconfig.pl line 34, near "}"
Execution of makeconfig.pl aborted due to compilation errors.
And the script as I currently have it. I'm assuming that I've gone overboard with defining variables, among other foibles.
#!/usr/bin/perl
use strict;
use warnings;
use autodie;
my $template_file_name="/home/hvanheerden/configtemplate.txt";
my ($ip, $hostname, $location) = split;
my $ofile_name=$hostname . ".txt";
my $TFILE="$template_file_name"
while(<>) {
next if /^#/;
($ip, $hostname, $location)
= split (/,/);
open(TFILE, "< $template_file_name") || die "config template file $
+template_file_name: $!\n";
$ofile_name = $hostname . ".txt";
open(OFILE, "> /home/hvanheerden/$ofile_name") || die "output confi
+g file $ofile_name: $!\n";
while (<TFILE>) {
s/##location##/$location/;
s/##hostname##/$hostname/;
s/##ip##/$ip/;
printf OFILE $_;
}
}
Thanks for the help. Err... Please continue to help! Thank you!