[boulder.pm] line/loop optimization?
Robert L. Harris
Robert.L.Harris at rdlg.net
Tue May 8 11:27:34 CDT 2001
Ok, I'm currently reading in a "config file" that says something like,
OPTION1=value1
OPTION2=value2
OPTION3=value3
OPTION4=value4
OPTION5=value5
and then reading in a template file that will have OPTIONX embeded. The
values will likely change per run so they can't be hard coded. I'm
currently doing something like this:
@Keys=keys(%ConfigOptions);
while(<TemplateIn>) {
chomp;
$Line=$_;
foreach $i (@Keys) {
$Line =~ s/$i/$ConfigOptions{$i}/;
}
}
Is there a better way to do a line by line substitution instead of looping
through @Keys each line?
Robert
:wq!
---------------------------------------------------------------------------
Robert L. Harris | Micros~1 :
Senior System Engineer | For when quality, reliability
at RnD Consulting | and security just aren't
\_ that important!
DISCLAIMER:
These are MY OPINIONS ALONE. I speak for no-one else.
FYI:
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
More information about the Boulder-pm
mailing list