#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;
use Text::CSV;

my @rows;
my $csv = Text::CSV->new ( { binary => 1 } )  # should set binary attribute.
  or die "Cannot use CSV: ".Text::CSV->error_diag ();

open my $fh, "<:encoding(utf8)", "$ARGV[0]" or die "$ARGV[0]: $!";
while ( my $row = $csv->getline( $fh ) ) {
#    $row->[2] =~ m/pattern/ or next; # 3rd field should match
  #cue,response,POS letter*,.mp3 filename,order,"*e- gismu, n- lo <SE> gismu"
  print "$row->[0]\t$row->[1]\t[sound:$row->[3]]\t\n";
    push @rows, $row;
}
$csv->eof or $csv->error_diag();
close $fh;

#print "stuff: ".Dumper(\@rows)."\n";
