Re: csv file question

[email protected] (yitzle)
Newsgroups perl.beginners
Message-ID <[email protected]>
I'm sure someone more experienced will have a far more elegant
solution, but something along these lines might work.
(Note: code untested)

%count;
while (<>) {
  if ($_ =~ /^"([^"]*)"/) {
    %count{$1}++;
  }
}
for (keys %count) {
  print "$_ - $count{$_}\n";
}

or, refractored,

%count;
while (<>) {
  %count{$1}++ if (/^"([^"]*)"/);
}
print "$_ - $count{$_}\n" for (keys %count);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.