Use Text::xSV:
use Text::xSV;
my $csv = Text::xSV->new(
filename => "foo.csv",
header => \@column_names,
);
while ($csv->get_row()) {
# You could use fetchrow_hash here, but I'll just print a message
# If you want a HoH or AoH, read up on extract_hash
my ($name, $alert_publisher) = $csv->extract(qw(Name alert_publisher
+));
print "Dll: $name\t is "
. (($alert_publisher eq 'X')? '' : 'not ')
. "an alert publisher\n";
}
It's worth noting that your problem as posed overwrites the hash each time you read in a new line. If this is not what you want, you need to construct an array (or a hash) of hashes ... see the comment for pointers.
The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon