For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2005 > Re[2]: datetime odd problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re[2]: datetime odd problem
John

2005-10-06, 9:55 pm

that's the whole code

apache;s log is being parsed

open LOG_FILE, "</access_log";
while(<LOG_FILE> ) {


$_=~s/Jan/1/ig;
$_=~s/Feb/2/ig;
$_=~s/Mar/3/ig;
$_=~s/Apr/4/ig;
$_=~s/May/5/ig;
$_=~s/Jun/6/ig;
$_=~s/Jul/7/ig;
$_=~s/Aug/8/ig;
$_=~s/Sep/9/ig;
$_=~s/Oct/10/ig;
$_=~s/Nov/11/ig;
$_=~s/Dec/12/ig;





@fields=split(/ /, $_);
$datetime=substr($fields[3],1);
@fields=split(/[\/:]/, $datetime);

my $cur_datetime=DateTime->new(year=>$fields[2],
month=>$fields[1], day=>$fields[0], hour=>$fields[3],
minute=>$fields[4], second=>$fields[5]);

}





From: Marcello <m.romani@spinsoft.it>
To: beginners@perl.org
Date: Thursday, October 6, 2005, 4:23:24 PM
Subject: datetime odd problem



Thursday, October 6, 2005, 4:23:24 PM, you wrote:

> John ha scritto:
[color=darkred]
> I think you should show us where those $fields come from.


> --
> Marcello Romani
> Developer
> Spin s.r.l.
> Reggio Emilia
> http://www.spinsoft.it








Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com