while () { # parse the date field with the '|' delimiter @dateField = split(/\|/); # parse the activity field by matching '|1|'word space word @activityField = split(/\|1\|\w\s\w/); # Start populating the fields as appropriate $date = $dateField[0]; $activity = $activityField[0]; ## Write the cleaned up data to the data file print DATAFILE "$date , "; print DATAFILE "$activity ,"; print DATAFILE "\n"; }