Philipp Traeder wrote:
Gunnar Hjalmarsson wrote:
Your wording "if a hash contains an element" is ambigous IMO. A
hash or associative array consists of key/value pairs, where the
keys are indexes and the values are considered to be the elements
(I think).
Ok - that's a possible terminology, and yes,
perl.org wrote:
> Wait a second...I always thought undef was a constant value. Is it always
> a
> function or are there both? I don't know that it matters but I prefer to
> show the parens when I invoke a function, but everywhere in my code I have
> $var = undef;
its a function. it always retur
ahh great, you all cleared it up perfectly for me, thank you. that perlfaq
section was great also.
Philipp Traeder wrote:
> On Friday 09 July 2004 19:25, Gunnar Hjalmarsson wrote:
>> Philipp Traeder wrote:
>> > I don't know what an expert would say,
>>
>> Neither do I. :)
>
> I think this is a
On Friday 09 July 2004 08:14, Christopher J. Bottaro wrote:
>
> i want to remove items from a hash then later see if they exist using
> defined(). for example:
>
> delete($hash{MYKEY});
> # blah blah
> if (defined($hash{MYKEY})) {
> # do blah blah
> }
>
> which should i use? delete()
On Friday 09 July 2004 19:25, Gunnar Hjalmarsson wrote:
> Philipp Traeder wrote:
> > I don't know what an expert would say,
>
> Neither do I. :)
I think this is a good base for talking about hashes. ;-)
> > but for testing if a hash contains an element, I normally use
> > "exists":
>
> Your wordi
Philipp Traeder wrote:
I don't know what an expert would say,
Neither do I. :)
but for testing if a hash contains an element, I normally use
"exists":
Your wording "if a hash contains an element" is ambigous IMO. A hash
or associative array consists of key/value pairs, where the keys are
indexes an
On Friday 09 July 2004 17:14, Christopher J. Bottaro wrote:
> i want to remove items from a hash then later see if they exist using
[..]
> which should i use? delete() or undef()? obviously i could write a small
> script to test this (which i'm going to know), but i'd also like to hear
> from an
On Fri, 9 Jul 2004 09:28:13 -0600, Wiggins d Anconia wrote
>
> > also, are these functionally equivalent?
> > $myvar = undef();
> > undef($myvar);
> >
>
> To my knowledge.
Wait a second...I always thought undef was a constant value. Is it always a
function or are there both? I don't know that
> i want to remove items from a hash then later see if they exist using
> defined(). for example:
>
You don't see if they exist using 'defined', you see if they are defined
:-). To see if they exist, you use 'exists'. Which hits to the heart of
your questions below.
> delete($hash{MYKEY});
Th
i want to remove items from a hash then later see if they exist using
defined(). for example:
delete($hash{MYKEY});
# blah blah
if (defined($hash{MYKEY})) {
# do blah blah
}
which should i use? delete() or undef()? obviously i could write a small
script to test this (which i'm goi
10 matches
Mail list logo