Try DBD::CSV module...so you can run SQL queries against the data set. btw..i would name the fields (columns) as follows for purposes of making the table more SQL friendly: x1,y1,x2,y2,x3,y3. Whilst this is not a normalized table, it would do the job..if you don't plan to add more tables. if you do plan to add more tables and functionality, then it would be best to normalize the table(s).
This table normalized would become two tables, something like:
table: Dataset
fields: dataset_id, description
primary key(s): dataset_id
table: Point
fields: dataset_id, sequence_id,x,y
primary key(s): dataset_id + sequence_id
Then the SQL for you question becomes a simple join and with a "where" clause.
the hardest line to type correctly is: stty erase ^H