open(my $data, '<', $file_c) or die "Could not open '$file_c' $!\n"; my $rows = 0; while (my $line = <$data>) { next if ($. == 1); chomp $line; my @fields = split "," , $line or next; $rows++; print"$fields[0] fields[1]"; } print "Total: $rows rows.\n" if $rows; print "No rows were found.n" unless $rows;