What string are you comparing? nbkid?? What does your input look like??
change towhile(<FILE1>) { chomp; my @fields = split(/:/, $_); my $result = qx{ /opt/bin/target -e$fields[2] }; print FILE2 "$fields[0]:$fields[1]:$result:NONBKID\n"; foreach my $configParameter (keys %{$configHash}) { my $nbkid = $configHash->{$configParameter}{'nbkid'}; my $ntid = $configHash->{$configParameter}{'ntid'}; if ($ntid eq $fields[1]) { print FILE2 "$fields[0]:$fields[1]:$result:$nbkid\n"; } } }
while(<FILE1>) { chomp; my @fields = split(/:/, $_); my $result = qx{ /opt/bin/target -e$fields[2] }; foreach my $configParameter (keys %{$configHash}) { my $nbkid = $configHash->{$configParameter}{'nbkid'}; my $ntid = $configHash->{$configParameter}{'ntid'}; if ($ntid eq $fields[1]) { print FILE2 "$fields[0]:$fields[1]:$result:$nbkid\n" i +f $field[3] eq $nbkid; print FILE2 "$fields[0]:$fields[1]:$result:NONBKID\n" if $fiel +d[3] ne $nbkid; } } }
maybe this is what you want? some of your information wasn't clear to me
In reply to Re: One loop or two
by jayto
in thread One loop or two
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |