Re: count in continuous time piece

2006-01-27 Thread Jeff Pang
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 00:00:05 itemE 250 ... (the item appear as 'name => vaule' s

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 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: use of uninitialized value....

2006-01-27 Thread Jay Savage
On 1/26/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote: > > The problem with defining your own versions of die, warn, croak, and > > carp is that only your code uses them. If another module croaks or > > Thats why you put it in a module and use it in all your scripts and if > it has not already bee

Re: count in continuous time piece

2006-01-27 Thread Jeff Pang
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 @records, { time => $timestamp, key => $key,

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: use of uninitialized value....

2006-01-27 Thread Chas Owens
On 1/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: snip > Thanks Jay for the hopefully final wrap up to the uninteded long email > thread. This was a good thing however b/c > I learned something new in this wonderful thing called Perl. > I agree and it make sense to use $SIG{__DIE__} for o

Re: use of uninitialized value....

2006-01-27 Thread DBSMITH
Jay Savage <[EMAIL PROTECTED] l.com>

Re: use of uninitialized value....

2006-01-27 Thread DBSMITH
Chas Owens <[EMAIL PROTECTED] .com>

including . in a pattern match

2006-01-27 Thread Keith Worthington
Hi All, I am still a newbie in Perl and it is only with the help of this list that I was able to construct the following pattern match. ($v_size_str =~ /\d+\s*['"]\s*x\s*\d+\s*['"]/i) The problem that I have just realized that this string will match the first line of this input file but not t

Re: including . in a pattern match

2006-01-27 Thread Chas Owens
On 1/27/06, Keith Worthington <[EMAIL PROTECTED]> wrote: snip > I have tried a couple of things but I am struggling with how to optionally > match the decimal point. > > I think what I need is the code equivilant of: >zero or more numbers followed by >zero or one decimal point followed by

Re: including . in a pattern match

2006-01-27 Thread Chas Owens
Another thing you can do is break your larger regexes into parts to make them more readable/maintainable. It also helps to use the x flag so that you can separate the individual tokens and comment them. #!/usr/bin/perl use strict; use warnings; use Regexp::Common; #FIXME: the border value shou

Re: including . in a pattern match

2006-01-27 Thread Chas Owens
> my $match=qr{#match the whole record for a widget > ^#start of the record > $border #a border value > \s* #optional spaces > $size#a size value > \s* #optional spaces > $tag #a tag value > $#optional sp