You can do:
if ( exists $hash{$Key} ) {
# the key exists, so do your check
}else {
# key does not exist, so add to hash
}
Also can use defined, but depending on how accessing there is
auto-vivfying(sp), which may create(if use is as defined $hash->{$Key} ) then from
the list I see the auto-vivfying kicking in.
Wags ;)
-----Original Message-----
From: Darfler, Jim (J.E.) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 11:05
To: '[EMAIL PROTECTED]'
Subject: comparing hash values
I am trying to populate a hash with key/value pairs, basically the file name and its
dates. I am extracting part of the file name to use as the key. Some of the keys will
be the same. I want to put a new value in only if its newer than the value currently
stored.
My problem is, how do I know there is a value based on the key? If there is already
one there, the comparison is easy, but what do I get as the value if the key/value has
not been used? Is there a way to know if the value has not been assigned?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]