Homework 8 - Perl


Given Wednesday, November 13, 2019

Due at 1159 on Sunday, December 1, 2019, via Blackboard

For this assignment, you will write a Perl script that parses the data in census2008.txt

 

The data is column delimited, with fields as follows:

 

SUMLEV,STNAME,CTYNAME,POPESTIMATE2008,BIRTHS2008,DEATHS2008

 

The data is from US Census Bureau estimates for 2008. The first column is a code for what “level” the data represents. It will be “040” for state data and “050” for county data. The next two columns are the state name and the county name (or state name repeated, if the date is for the whole state). Then we have the estimated population for that state or county in 2008, the number of  births for that state or county for 2008 and the number of deaths for that state or county for 2008.

 

Your script should report the state with the highest and the state with the lowest birth rates in 2008. Report the birth rate as births per 100 population.

Your script should also report the counties in Washington with the highest and lowest birth rates.

 

In all four cases, report the place name (the county or state) and the number of births per 100 population.

 

(Note that all counties in the US are included in the file, but your search of per-county birthrates should be limited only to the state of Washington.)

 

The scoring will be 6 points for  a working Perl script, and 1 point each for correctly finding and reporting each of the facts requested.

 

Example output:

Lowest birth rate in XXXXX: 1.xxx

Highest birth rate in XXXXX: 2.xxx

In Washington:

   Lowest birth rate in XXXXX County, WA: 0.xxx

   Highest birth rate in XXXXX County, WA: 2.xxx