I have a csv file like
Genome Name,Resistance_phenotype,Amikacin,Gentamycin,Aztreonam AB1,,Susceptible,Resistant,Resistant AB2,,Susceptible,Susceptible,Susceptible AB3,,Resistant,Resistant,NA
I need to fill 2nd column i.e. Resistant phenotype with MDR, XDR and susceptible. for which I have to match antibiotic resistance profile like if in first row gentamycin & antreanam both are resistant the 2nd column will be filled with MDR and in 3nd row if all 3 are susceptible the 2nd column of 3rd row will be filled with susceptible.
I have written a code mentioned below which only display columns of the csv file. I got stuck what to do further.
#!/usr/bin/perl
use strict;
use warnings;
my $file = 'text.csv';
my @data;
open(my $fh, '<', $file) or die "Can't read file '$file' [$!]\n";
while (my $line = <$fh>) {
chomp $line;
my @fields = split(/,/, $line);
print $fields[0], "\n";
#print $fields[1], "\n";
}
close $file;
Genome Name,Resistance_phenotype,Amikacin,Gentamycin,Aztreonam AB1,MDR,Susceptible,Resistant,Resistant AB2,Susceptible,Susceptible,Susceptible,Susceptible AB3,MDR,Resistant,Resistant,NA