Pam Derks wrote:

> the program ran as expected
> but I did get this error:
> Use of uninitialized value at instr_guts.pl line 39, <FILE2> chunk 2.
>
> here's line 39:
>  39            if($replace =~ $1){
> ..

> here's the sample output:
> YES: C. J. S. WALLIA
> 1: Instructor: C. J. S. WALLIA
>
> 2: C. J. S. WALLIA
> SUB: C. J. S. WALLIA, Ph.D., Stanford, has taught at UC Berkeley and St
> anford. He has served as a
>     contract editor for several major publishing houses and high-technolog
> y corporations, and is the author of two books on computer-assisted publishing. A 
> short story wri
> ter, he edits and publishes an online literary magazine, IndiaStar Review of Books 
> (www.indiastar.
> com).
> XXX

Hi Pam,

Was this all the output you got before the error?  If so, then it ran as I expected.  
I'm alittle mystified as to how execution got into the loop with $replace 
uninitialized.  My best guess is that the operation as a whole returned success in 
assigning the current, null string, value to $replace.  I know that I have been warned 
to use if defined as the test in such contexts.  Now I see why.

There is nothing in $replace by the time you seek the instructor information for the 
second course listing, because by that time, your file pointer on the BIOS file has 
reached the eof.  There is some SEEK syntax that can reset your file pointer to the 
start, but your code as you have it now will not do it.  Either that, or you will have 
to open, read, and close the file for each call to replace_it().

I think you are going to have to store the biography information within your program 
to get any kind of efficient performance.  A hash would be highly efficient.  Using a 
hash to reference the bio per name would just whip right through this.

Joseph


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

Reply via email to