http://qs1969.pair.com?node_id=1179415


in reply to Re: Comparing string to array elements
in thread Comparing string to array elements

Thank you for the reply Rolf! I'm guessing I should've put all the code instead of a little snippet, as it isn't very long.

use strict; use warnings; use File::Slurp; my $countfile = 1; open (IN, 'C:\terms.txt'); my @terms = <IN>; close IN; open (OUT,'>>C:\result.txt'); while ($countfile < 10000) { my $text = read_file('C:\file' . $countfile . '.xml') or die "Can' +t open file!"; if($text =~ /upperboundary(.+?)lowerboundary/s){ if(grep {$_ eq $1} @terms) { print OUT "$1\t"; } } close IN; $countfile++; open (IN, 'C:\file' . $countfile . '.xml') or die "End of files!"; } close OUT;

I can see the array populated if I print it, but there must be some other thing that's destroying the output at the middle...