while (my $line = ) { next unless $line =~ m/\s([\w ]+? PRIMARY SCHOOL)/; push (@schools, $1); }