I have a csv file xyz.csv
with contents
name,age,place,phone
xyz,12,ohio,7372829
sed,23,hrh,9890908
I need to parse the csv file and check whether it is a empty file i.e. it doesn't have the values for the headers provided.
a null file xyz.csv
would contain just the headers (headers no may decrease or increase) e.g. decreased:
name,age,place,phone
increased:
name,age,place,mob,phno,ht
how do i check for a null file in below code and print whether is is null or not?
i have developed below script to parse the csv
open(my $data, '<', $file_c) or die "Could not open '$file_c' $!\n";
while (my $line = <$data>)
{
next if ($. == 1);
chomp $line;
my @fields = split "," , $line;
print"$fields[0] fields[1]";
}