Re: defined{ness}

2009-03-17 Thread Dermot
2009/3/17 Chas. Owens : > On Tue, Mar 17, 2009 at 09:30, Dermot wrote: > snip >> if ($x{$x})  inspects the key's value, not simply the existence of a key? > snip > > Yes, but beware of autovivification (i.e. the creating of keys by > trying to look at their values).  You are safe with this simple

Re: defined{ness}

2009-03-17 Thread Chas. Owens
On Tue, Mar 17, 2009 at 09:30, Dermot wrote: snip > if ($x{$x})  inspects the key's value, not simply the existence of a key? snip Yes, but beware of autovivification (i.e. the creating of keys by trying to look at their values). You are safe with this simple case, but when dealing with HoHs or

Re: defined{ness}

2009-03-17 Thread Dermot
2009/3/17 Jay Savage : > On Tue, Mar 17, 2009 at 8:16 AM, Dermot wrote: >> Hi All, >> >> I am unsure if the following statement is going to do what I want. >> >> I want to test if there is a value in $hash_ref{'someval'} NOT if the >> key is defined. I'd also like to avoid un-sightly "undefined va

Re: defined{ness}

2009-03-17 Thread Jay Savage
On Tue, Mar 17, 2009 at 8:16 AM, Dermot wrote: > Hi All, > > I am unsure if the following statement is going to do what I want. > > I want to test if there is a value in $hash_ref{'someval'} NOT if the > key is defined. I'd also like to avoid un-sightly "undefined value" > errors. Hi Dermot, It

Re: defined{ness}

2009-03-17 Thread Jeff Pang
Dermot : Hi All, I am unsure if the following statement is going to do what I want. I want to test if there is a value in $hash_ref{'someval'} NOT if the key is defined. I'd also like to avoid un-sightly "undefined value" errors. So which of the following is best: if (defined($hash_ref{'some

defined{ness}

2009-03-17 Thread Dermot
Hi All, I am unsure if the following statement is going to do what I want. I want to test if there is a value in $hash_ref{'someval'} NOT if the key is defined. I'd also like to avoid un-sightly "undefined value" errors. So which of the following is best: if (defined($hash_ref{'someval'}) {}