Re: Thoughts on comments

2007-05-13 Thread Chas Owens
On 5/14/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: Is it possible to use too many comments? I'm looking at a script I wrote and think I may have made it less clear by trying to make it more clear. Yes, it is very easy to have too many comments, especially if you are using them in the wrong w

Re: Thoughts on comments

2007-05-13 Thread Jeff Pang
Mathew Snyder 写道: Is it possible to use too many comments? I'm looking at a script I wrote and think I may have made it less clear by trying to make it more clear. If you look at Spamassassin's codes,you'll find its comments are more than codes.One thing I'm not satisfied with in perl is tha

Thoughts on comments

2007-05-13 Thread Mathew Snyder
Is it possible to use too many comments? I'm looking at a script I wrote and think I may have made it less clear by trying to make it more clear. -- Keep up with me and what I'm up to: http://theillien.blogspot.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread Mathew Snyder
That's waaay over my head. The method I used works so I'll stick with that. Thanks though. :) Keep up with me and what I'm up to: http://theillien.blogspot.com Chas Owens wrote: > My understanding of the problem: > > You have a ref to a HoH and you need to find all of the first set of >

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread Chas Owens
My understanding of the problem: You have a ref to a HoH and you need to find all of the first set of keys that have a specific, but unspecified at coding time, second key or value. For key I would do something like this my $key2 = func_to_get_key2(); for $key1 (grep { exists $store->{$key1}{$k

Re: About a reg expression ?:

2007-05-13 Thread Ken Foskey
On Sun, 2007-05-13 at 10:49 +0800, 小楊 wrote: > Does anyone know the following syntax's meaning or usage? > > Can anyone help me to understand this syntax? Or if available, can anyone > provide me some useful example to understand more? > > Thank you all that help me. > > The syntax is as follow:

Re: About a reg expression ?:

2007-05-13 Thread Chas Owens
On 5/13/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: snip or /a (?:black|grey|white|) cat/; snip It is sad to say, but I had never thought of using a pipe at the end to cause a submatch to be optional. That is a nifty solution. Too much thinking inside the box for me, I guess. I would have said

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread Mathew
Rob Dixon wrote: > Mathew Snyder wrote: >> >> [EMAIL PROTECTED] wrote: >>> >>> Mathew Snyder wrote: A subroutine I'm working on takes two hash references. The hashes are each actually a HoH. timesheet(\%opsTotal, \%opsEnvTotal); The problem I'm having is t

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread Rob Dixon
Mathew Snyder wrote: [EMAIL PROTECTED] wrote: Mathew Snyder wrote: A subroutine I'm working on takes two hash references. The hashes are each actually a HoH. timesheet(\%opsTotal, \%opsEnvTotal); The problem I'm having is that I need to look past the first hash and into the second for the

Re: About a reg expression ?:

2007-05-13 Thread Dr.Ruud
yitzle schreef: > John: >> [m/a (?:black|grey|white) cat/] >> Will match one of these: [...] >> - "a cat" (please note two spaces) > > Correction: Will not match "a cat" > That requires: m/a (?:black|grey|white)? cat/; or /a (?:black|grey|white|) cat/; (Yitzle, please note how I redacted th

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread Mathew Snyder
Thanks, I found a simpler approach though. I set a variable to '1' and check it in an if statement: if ($check == 1) { Perform steps }else{ Perform other steps. } After I pass the hashes I need to use for "Perform steps" I set the variable to '0' and then pass the next set of hash

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread Mathew Snyder
To make this even more tricky, if the user shows up in even one of the second hashes the whole %$dept hash is affected. We have $dept{customer}{user} $dept{customer}{user1} $dept{customer1}{user} $dept{customer1{user1} $dept{customer2}{user} So, even though user2 i

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread yaron
Hi again, In that case can use the following: if ($dept and exists($dept->{customer}{user}){ }else{} Yaron Kahanovitch - Original Message - From: "Mathew Snyder" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: "Perl Beginners" Sent: Sunday, May 13, 2007 10:22:53 AM (GMT+0200) Auto-

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread Mathew Snyder
That's the problem. 'user' isn't in the first hash. It's in the second hash. The hash looks like $dept{customer}{user}. I need to skip $dept{customer} and check for $dept{customer}{user}. Mathew Keep up with me and what I'm up to: http://theillien.blogspot.com [EMAIL PROTECTED] wrote: > Hi, >

Re: Stuck on a hash referrence, kinda

2007-05-13 Thread yaron
Hi, I am not sure that I understand your problem. In General if you want to check the existence of the key "user" in the first hash, you can use the following if ($dept and exists($dept->{user}){ }else{} Hope that helps Yaron Kahanovitch - Original Message - From: "Mathew Sny