In the code below it is supposed to find a configuration template for each client, where, for example, the Joe template joe.originaljoeand writes the output to joe:
foreach my $name (@customers) {
my $template = "$name.original$name";
open my $in, "<", $template or die "$0: open $template";
open my $out, ">", $name or die "$0: open $name";
my $output = process_template $in;
print $out $output or die "$0: print $out: $!";
close $in;
close $out or warn "$0: close $name";
}
source
share