Hi all,

I'm havig problems getting information out of a file and having it write each 
of the dates to an array. The problem is, I don't want duplicates.

A sample log entry looks like this:
[07/Feb/2006:19:57:35 +0000] 1.2.3.4 SSLv3 RC4-MD5 "GET /package-update.tar 
HTTP/1.1" 231 Ed Smith

....
print "Processing log..\n";
while ( <> )  {
        ## Process the line into workable chunks
        chomp;
        ($date, $time, $ip, $ssl, $cipher, $get, $pkg, $http, $pid, $name1, 
$name2, $name3 ) = split " ";
        $date =~ ( s/\[//g );
        $date =~ ( s/\// /g );
        $date =~ ( s/\:(\d+):(\d+):(\d+)//g );
        $name = join (" ",$name1,$name2,$name3);

        if ($total_entries == 1) {
                $start_date = $date;
        }
        ## If the old date is equal the current date
        ## increment the datecount for that day
        print "$date\n";
        print "$olddate\n";
        if (!(grep({$date} @datecollection))) {
                $datecollection[$total_entries] = $date;
                $olddate = $date;
        } else {
                $datecount++;
                print "Date count: $datecount\n";
        }
        $total_entries++;
        ....
}

For some reason, the dates aren't appending and the counter isn't working 
right. Can someone please help?

Thanks in advance! :)

-AC
--
It is proverbial that from   (\`--/') _ _______ .-r-.  
a hungry tiger and an         >.~.\ `` ` `,`,`. ,'_'~`.          
affectionate woman there is  (v_," ; `,-\ ; : ; \/,-~) \            
no escape. -Ernest Bramah     `--'_..),-/ ' ' '_.>-' )`.`.__.')   
hobbes at vaxer dot net      ((,((,__..'~~~~~~((,__..'  `-..-'fL    

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to