in reply to Need to extract first n rows and parsing multiple files

 [csv rows] csv rows -> Sort rows in a csv file based on a date column, merging .csv text input based on matching column field values in multiple rows, DBD::CSV - Not Fetching Rows

So grab either DBD::CSV or Text::CSV and copy/paste from the examples ... and come back when you're stuck

Also, list of super examples here, some may even solve your problem exactly

Good luck