I have a hopefully easy problem. I am trying to isolate information between two patterns to both capture the information between (here, the case name) and count the instances a particular word (here, the word Education but I would also like to count the number of words in general). I am able to isolate the beginning pattern and the end pattern across multiple line but I can't figure out how to capture and count ALL of the this text between the patterns. When I run my script, I only capture the last matched line and only count the last instance. I am not able to manipulate the entire string of text across multiple lines between the established patterns.
This is my script:
my $casename = ''; my $count = 0; $/=""; # paragraph input mode while (<IN>) { if (/^\d+\sof\s\d+\sDOCUMENTS$/mx ... /^No.\s\w+$/mx){ if (/^(.*)/){ $casename=$1;} if (/EDUCATION/g){ $count++;} next;} } print "Case Name: $casename\n"; print "Education: $count\n";
Which does isolate the correct bounded text in a much larger file, as such:
97 of 141 DOCUMENTS HOKE COUNTY BOARD OF EDUCATION; HALIFAX COUNTY BOARD OF EDUCATION; ROBESON COUNTY BOARD OF EDUCATION; CUMBERLAND COUNTY BOARD OF EDUCA\TION; VANCE COUNTY BOARD OF EDUCATION; RANDY L. HASTY, individually and as guardian ad litem of Randell B. Hasty; STEVEN R. SUNKEL, individually and as guardian ad litem of Andrew J. Sunkel; LIONEL WHIDBEE, individually and as guardian ad litem of Jeremy L. Whidbee; TYRONE T. WILLIAMS, individually and as guardian ad litem of Trevelyn L. Williams; D.E. LOCKLEAR, JR., individually and as guardian ad litem of Jason E. Locklear; ANGUS B. THOMPSON II, individually and as guardian ad litem of Vandaliah J. Thompson; MARY ELIZABETH LOWERY, individually and as guardian ad litem of Lannie Rae Lowery; JENNIE G. PEARSON, individually and as guardian ad litem of Sharese D. Pearson; BENITA B. TIPTON, individually and as guardian ad litem of Whitney B. Tipton; DANA HOLTON JENKINS, individually and as guardian ad litem of Rachel M. Jenkins; LEON R. ROBINSON, individually and as guardian ad litem of Justin A. Robinson, Plaintiffs and ASHEVILLE CITY BOARD OF EDUCATION; BUNCOMBE COUNTY BOARD OF EDUCATION; CHARLOTTE-MECKLENBURG BOARD OF EDUCATION; DURHAM PUBLIC SCHOOLS BOARD OF EDUCATION; WAKE COUNTY BOARD OF EDUCATION; WINSTON-SALEM/FORSYTH COUNTY BOARD OF EDUCATION; CASSANDRA INGRAM, individually and as guardian ad litem of Darris Ingram; CAROL PENLAND, individually and as guardian ad litem of Jeremy Penland; DARLENE HARRIS, individually and as guardian ad litem of Shamek Harris; NETTIE THOMPSON, individually and as guardian ad litem of Annette Renee Thompson; OPHELIA AIKEN, individually and as guardian ad litem of Brandon Bell, Plaintiff-Intervenors v. STATE OF NORTH CAROLINA and the STATE BOARD OF EDUCATION, Defendants No. 530PA02
But, the returned information is as follows:
Case Name: No. 530PA02 Education: 2
Any idea what I am doing wrong? Thanks so much for your help! Can't tell you how much I appreciate it. Best, Michael
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |