Re: count in continuous time piece

2006-01-27 Thread Chas Owens
On 1/27/06, Jeff Pang <[EMAIL PROTECTED]> wrote: > Hello,Chas, > > Thanks advanced for your good suggestions. > I tidy up all the words said by you,and write the code as following.Is it > right? > > while(<$sock>) > { > my ($key,$value) = split; > my $timestamp = time(); > push @recor

Re: count in continuous time piece

2006-01-27 Thread Jeff Pang
ng() if $sum{$_} > LIMIT; } } -Original Message- >From: Chas Owens <[EMAIL PROTECTED]> >Sent: Jan 27, 2006 11:14 PM >To: Jeff Pang <[EMAIL PROTECTED]> >Cc: beginners@perl.org >Subject: Re: count in continuous time piece > >On 1/27/06, Jeff Pang <[EMAIL PROTECT

Re: count in continuous time piece

2006-01-27 Thread Chas Owens
On 1/27/06, Chas Owens <[EMAIL PROTECTED]> wrote: > for (@records) { > delete $_ if $_->{time} < time() - 5*60; > } Oops, I misused the delete() function. I needed to use the shift() function instead: shift @records while $records[0]{time} < time() - 5*60; -- To unsubscribe, e-mail: [EMAIL

Re: count in continuous time piece

2006-01-27 Thread Chas Owens
On 1/27/06, Jeff Pang <[EMAIL PROTECTED]> wrote: > Now I'm still confused on this work.Maybe I have not described the problem > clearly. > Fox example,there are some items coming in continuous time piece: > > 00:00:01 itemA 200 > 00:00:02 itemB 100 > 00:00:03 itemC 150 > 00:00:04 itemD 300

Re: count in continuous time piece

2006-01-27 Thread Jeff Pang
cal record out of 5 minutes relative the current time } } How can I do it?Any suggestion is welcome.Thanks. -Original Message- >From: Chas Owens <[EMAIL PROTECTED]> >Sent: Jan 24, 2006 9:47 AM >To: Jeff Pang <[EMAIL PROTECTED]> >Cc: beginners@perl.org >

Re: count in continuous time piece

2006-01-24 Thread Chas Owens
On 1/24/06, Jeff Pang <[EMAIL PROTECTED]> wrote: > hi,lists, > I want to do this work: count something in continuous given time piece,such > as 10 > minutes.Fox example,there are the lines coming to the socket server as > following: > > 1_feifish1_01_1000ybyg:11530514:get > 1_swm_mail_01_100k8qte

count in continuous time piece

2006-01-24 Thread Jeff Pang
hi,lists, I want to do this work: count something in continuous given time piece,such as 10 minutes.Fox example,there are the lines coming to the socket server as following: 1_feifish1_01_1000ybyg:11530514:get 1_swm_mail_01_100k8qte:13901448:get 1_dajia###_01_1006x8jh:11652267:put ... each line