Hi all,

In FILE1  I want to replace all the lines containing:
Instructor: [A-Z].+  

with the complete biography for each instructor in FILE2

or
replace this text in FILE1       
Instructor: GENE ABBOTT

with this text from FILE2
GENE ABBOTT, M.A., has worked in vocational and adult education since 1973. He has been
department chair, lead teacher, mentor, and consultant, and is program manager for the 
Marin
County Regional Occupational Program.


Problem:
1 .I'm getting an infinite loop on the instructors' names in replace_it()
2. and @replace never gets the instructors' bios


any clues would be appreciated,

thanks in advance, Pam




-----------------------------------------------------
code thus far

#!/usr/bin/perl -w
use strict;

#Purpose: replace Instructor: Name with bio from backmatter

open(FILE1, "+<write.txt") or die ("no IN  file:  $!");
open(FILE2, "instructor.txt") or die ("no instructor file:  $!");

my @bios = ();
my $bio;

get_name();

sub get_name{
        my ($match, $line);

        while ($line = <FILE1>){
                $match = '^Instructor:\s+([A-Z].+$)';
                foreach ($line =~ /$match/){
                        push(@bios, $1);
                }
        }
        replace_it([EMAIL PROTECTED]);

} #end get_name


sub replace_it{
        my ($aref, $line, $text);
        my @replace = ();
        $aref = [EMAIL PROTECTED];



     while($line = <FILE2>){
                foreach $bio(@$aref){
                      print("$bio\n");
#not working #########################
                      if (/$bio/ .. /\.^[A-Z]/){
                            push(@replace, $line);
                      }
                }
    
          }
          print("@replace\n");
 } #end replace_it
    


close FILE1;
close FILE2;

------------------------------

output:

C. J. S. WALLIA
Use of uninitializd value at try4 line 36, <FILE2> chunk 1.
MICHAEL LEE ZEITSOFF
Use of uninitialized value at try4 line 36, <FILE2> chunk 1.




-----------------------------------------------------
Sample: FILE1

Practical Grammar for 
Writers and Editors
X155 (1 semester unit in English)
Working editors and writers often find that they need to improve their command of 
English
grammar. This course concentrates on grammar as an effective technique for using 
language to
clarify thought. Basic concepts are analyzed, with logic as the focus.
Section 1: Wednesdays in Berkeley
Instructor: GENE ABBOTT
n    8 evenings
n    July 2 to Aug. 20: Wed., 6:30-9:30 pm
n    Berkeley: Room 105, UC Berkeley Extension International Center, 2222 Harold Way
n    $325 (EDP 025122)

Section 2: Online
Instructor: MICHAEL LEE ZEITSOFF
n    Online course: Internet access required
n    Enroll anytime: You have 6 months to complete
n    $350, plus $50 online resource fee (EDP 017830)
n    For information and to enroll (510)
642-4124

Editorial Workshop I: 
Introduction to Copyediting
X405 (2 semester units in Journalism)
course description blah blah blah....
Instructor: DAVID COUZENS
n    8 evenings and 2 Saturdays
n    June 3 to July 22: Tues., 6:30-9:30 pm; also 
June 21 and July 12: Sat., 9 am-noon
n    San Francisco: 209 Richardson Hall,
San Francisco Center, 55 Laguna St.
n    $395 (EDP 025031)


sample FILE2

VIRGINIA ABASCAL, M.A., is a freelance director and has directed more than 40 plays in
theaters including Theatreworks, San Jose State Company, Asian American Theatre 
Company,
Speakeasy Theatre, and Theatre Artists of Marin, where she was resident director for 
eight years,
working with new plays. She has won Critics Choice, Bay Area Critics Circle, and Dean
Goodman production awards.
GENE ABBOTT, M.A., has worked in vocational and adult education since 1973. He has been
department chair, lead teacher, mentor, and consultant, and is program manager for the 
Marin
County Regional OccupationalProgram. He has taught in adult education, community 
college,
and ROP. He has lectured throughout California on the topic of &quot;Thinking 
Curriculum in
Technical Education.&quot;


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to