Hi Noah,

Would defining $templateConfiguration outside of the for loop be sufficient for what you need?

i.e.,

my $templateConfiguation;
foreach my $templateConfigFilename (@templateConfigFilenames) {
   $templateConfigFilename = "$TemplateDirectory/$templateConfigFilename";
(my $sortedTemplateConfigFilename = $templateConfigFilename) =~ s/.(configuration.txt)/.sorted-$1/;
   push (my @sortedTemplateConfigFilenames, $sortedTemplateConfigFilename);

   # go read template files and save as sorted
$templateConfiguation = &readConfigTemplate($templateConfigFilename, $sortedTemplateConfigFilename);
}


You probably should give it some initial value or do some checking just in case nothing is assigned to it within the for-loop...

Ray



Noah wrote:
Okay I see why $templateConfiguration is defined inside a for loop. how can I make sure the referenced hash that is returned inside the for loop is passed to the main portion of the program.

Here is the for loop.

--- snip ---

foreach my $templateConfigFilename (@templateConfigFilenames) {
$templateConfigFilename = "$TemplateDirectory/$templateConfigFilename"; (my $sortedTemplateConfigFilename = $templateConfigFilename) =~ s/.(configuration.txt)/.sorted-$1/; push (my @sortedTemplateConfigFilenames, $sortedTemplateConfigFilename);

    # go read template files and save as sorted
my $templateConfiguation = &readConfigTemplate($templateConfigFilename, $sortedTemplateConfigFilename);
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to