I am attempting to write a script that reads each line of a file into a separate array and does some work on it then puts it all back together and I think I need to use the 'shift()' command to read each line into its own array, but I need help nesting it into a while loop (while not eof)
So here is some of the raw data in the file:
Vallejo-1991-Jan-20-The_Bride-BLH
Vallejo-1991-Jan-20-The_Bride-BLH
Berkeley-1992-Jan-26-I_Corinth_14-BLH
berkeley-1992-Jan-26-I_Corinth_14-BLH
Union City-1991-July-14-Promises_covenent_of_circumcision-BLH
UC-1991-July-14-Promises_covenent_of_circumcision-BLH
I want the output to replace the Location (Vallejo, etc.) with a consistent syntax (Capital first letter and city spelled out; e.g. Union City, Vallejo, Berkeley, there are only these three locations) AND, more importantly I want to change the Month element into a number (e.g July - 07, Jan -01, unfortunately the abbreviations aren't always consistent, BUT the first three letters usually are (Jul, Jan, Aug, etc.)
So the output of the data above should be:
Vallejo-1991-01-20-The_Bride-BLH
Vallejo-1991-01-20-The_Bride-BLH
Berkeley-1992-01-26-I_Corinth_14-BLH
Berkeley-1992-01-26-I_Corinth_14-BLH
Union City-1991-07-14-Promises_covenent_of_circumcision-BLH
Union City-1991-07-14-Promises_covenent_of_circumcision-BLH
here is what I have so far:
# Open File containing raw data
open(FILE, "test2.txt") or die("unable to open file");
# read file into an array
@RawData = <FILE>;
close(FILE);
while (<>) {
#read in Folder name
@FileNames = shift(@RawData);
I know how to write the code to split the data into arrays BUT I dont know how to analyze and replace the data...