I am very new to Perl and need your help
I have a CSV file xyz.csvwith the contents:
here level1 and er values โโare line names ... not numbers ...
level1,er
level2,er2
level3,er3
level4,er4
I will analyze this CSV file using the script below and pass the fields to the array in the first run
open(my $d, '<', $file) or die "Could not open '$file' $!\n";
while (my $line = <$d>) {
chomp $line;
my @data = split "," , $line;
@XYX = ( [ "$data[0]", "$data[1]" ], );
}
For the second run, I take input from the command line and save it in a variable $val. My program should parse the CSV file from the value stored in the variable until it reaches the end of the file
for instance
I enter level2, so I need a script to parse the second line to the end of the CSV file, ignoring the values level2in the file and passing those values โโ( level2to level4) to@XYX = (["$data[1]","$data[1]"],);}
level2,er2
level3,er3
level4,er4
level3, script CSV, level3 (level3 level4) @XYX = (["$data[0]","$data[1]"],);}
level3,er3
level4,er4
? , . .