Pam Derks wrote: > thanks for help, here's my solution, any further comments are welcomed... > > thanks, Pam
Hi Pam, What are the results from your test run? I foresee trouble beyond the first replaced instrucor name. Let me know if I am off base here. Joseph > #!/usr/bin/perl -w > use strict; > > #Purpose: replace Instructor: Name with bio from backmatter > > open(CAT, "catalog.txt") or die ("no IN file: $!"); > open(BIOS, "instructor.txt") or die ("no instructor file: $!"); > open(OUT, ">out") or die ("no out file: $!"); > > select (OUT); > > get_name(); > > sub get_name{ > my ($match, $line); > > while ($line = <CAT>){ > $match = '^Instructor:\s+([A-Z].+$)'; > if($line =~ /$match/){ > print("YES: $1\n"); > print("1: $line\n"); > replace_it($1); > next; > } > else { > print("NO: $line\n"); > } > } > > } #end get_name > > sub replace_it{ > my $end = "XXX"; > my ($replace, @lines); > print("2: $1\n"); > > while ($replace = <BIOS>){ > if($replace =~ $1){ > push(@lines, $replace); > last if($replace =~ $end) > } > } > print("SUB: @lines\n"); > return; > } #end replace_it > > close CAT; > close BIOS; > close OUT; [snip] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]