#!/usr/bin/perl use Text::CSV qw(csv); use strict; use warnings; my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1 }); my $o = \*STDOUT; # Read/parse CSV while (my $row = $csv->getline (\*DATA)) { my @selected = ( splice(@{$row}, 0, 2), splice(@{$row}, -6, 2) ); $csv->say($o, \@selected); } exit(0); __DATA__ 8, 9, NULL, 'Filler', '555-999', '77:88', 0, 0, 0, 0 8, 9, NULL, 'Filler', '555-999', '77:88', 'A \' B , C', 0, 0, 0 8, 9, NULL, 'Filler', '555-999', '77:88', 0, 0, 0, 0