Can this data be made available via a database (mySql or SQLite?) instead? The tasks you request are really very easy in SQL.
You could take the tab-delimited file and convert to a CSV file and then use
DBI and
DBD::CSV (also see the
Tutorials) ...
(
Update: DBD::AnyData can be used to read your tab-delimited data as-is ; You can even construct in-memory tables from a string!)
Example SQL statements:
SELECT ... FROM your_table ORDER BY in, out;
SELECT day, SUM(in + out) FROM your_table GROUP BY day;