in reply to Simply Too Slow Find and Replace
This method does away with looping through arrays and puts it into a little better of a data structure. let me know if this doesn't make sense. kudos. krazken#pseudo code open lookup file while(<lookup>) { chomp; my ($find,$replace)=split /=/; $hash{$find}=$replace; } close lookup open file to work on while(file) { my $field_to_lookup_on=split/unpack whatever if(exists $hash{$field_to_lookup}) { $new_field=$hash{$field_to_lookup}; } else { $new_field=$field_to_lookup_on; } put field back in record print record.
|
|---|