Toby Stuart <[EMAIL PROTECTED]> had this to say,
> If i understand what u want, the following works (i'll leave the printing to
> another file up to you)
 
 <snip>

Thanks for the quick reply, Toby.  With your suggestions, here's what I
have (and it works, too).  I have some questions about it, because, as I
said before, I think I understand hashes, just not what it takes to
manipulate them.  But I'm too tired right now to form a good question.
I'll give this some thought and then post some questions.

Again, thanks!

deb


#!/usr/local/bin/perl 

use strict;
use warnings;

my $fileout= "./stats.out";
my $filein = $ARGV[0];
my %totals;
my $date;
my $count;

open (F, "$filein") || die "Oops, did you type the right filename?\n";
while (<F>) 
{
   chomp($_);
   ($date,$count) = split(/,/,$_);
   $totals{$date} += $count;
}
close(F);

while ( ($date,$count) = each %totals)
{
   open (F,">>$fileout") || die "Cannot open $fileout for writing.\n";
   print F "$date : $count\n";
}
close(F);


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
          There are 010 types of people in the world:
      those that understand binary, and those that don't.
τΏτ
 ~ 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to