while ($fields = read_fields($filename)) {
$rank = $fields['rank']; // the third field is now called rank
print "$rank\n";
}
However, here's the most efficient method:
while (list(,,$rank,,) = fgetcsv($fh, 4096)) {
print "$rank\n"; // directly assign $rank
}
Be careful you don't miscount the amount of commas;
you'll end up with a bug.