Jim Gibson wrote on 7/29/2014 10:08 PM:
>
> On Jul 29, 2014, at 5:12 PM, ESChamp <[email protected]> wrote:
>
>> ESChamp wrote on 7/28/2014 6:59 PM:
>>
>> Let me backtrack and provide some background information.
>>
>> This script processes two files, recapfile, a plain text file, and copy,
>> and HTML-formatted file.
>>
>> It reads copy into an array, and recapfile into another array. Then it
>> writes a new array which contains all the initial lines of the recapfile
>> array from the first line down to but not including the first line
>> containing / RESULTS OF BOARD 1/
>
> Most of that information is superfluous. You need to concentrate on the
> precise problem that you are having.
Didn't I do that in the next section?
>> And here is where it goes wrong ('No <pre> found')
>>
>> ($index) = grep $hfile[$_] eq '<pre>', 0 .. $#hfile;
>> die 'No <pre> found' unless $index;
>>
>> I printed hfile using
>> foreach (@hfile) { print "$_\n"; }
>>
>> and it looks fine! That is, there is a line with only <pre> on it!!!
>
> Perhaps the line containing ‘<pre>’ contains whitespace characters that you
> cannot see when you print it.
Good suggestion! I looked at the file with a hex editor and a set of
characters like this
0D 0A 3C 70 72 65 3E 0D 0A
so no invisible characters.
> Or maybe <pre> occurs on the first line, in which case $index will have the
> value 0, which is treated as false, and your program will die.
<pre> is line 709. No other line is simply <pre>
> This is all speculation because you have not provided us with your exact
> program and data files.
I was warned not to post a 3000 line data file and a 150 line program,
but if you'd like me to send them to you off-line, I will.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/