Hi.  I've had similar problems in other areas with the kind of problem ur
describing.  The problem is ur using "in-band signaling", as we say in the
telecom world.  Remember when kids could whistle into a phone and make free
long distance calls?  That was because of in-band signaling, the control
information and data were in the same channel.  So they came up with out of
band signaling so that control data can be transmitted unambiguously and
without interference from the data stream.  History lesson over. :)

What u could do is unconditionally return array context where the first
element represents the response type, and the second value is the real data.
U'll have to handle that in ur code but it should solve the clobbering
problem.  Another possiblity is to return the undef in list context.  keys()
always wants to return a list anyway.

As for the case insensitive thing, just do lc() on lookup. ;)
($key) = grep { lc $string eq lc $_ } keys(%hash);

Also does simply doing keys(%$hTied) give the proper list of keys even with
undef present?  If so u would work around by doing @keys = ... and iterating
over that list.

HTH


At 02:42 PM 9/30/2008 -0400, John Deighan wrote:
>foreach my $key (keys(%$hTied)) {
>    print("$key = $hTied->{$key}\n");
>    }
>
># --- the above prints nothing, as if the hash %$hTied has no keys, but
>So, understanding the problem, I figured that I'd go into my library and 
>simply fix the problem. So, I looked at my FIRSTKEY function. What it is 
>supposed to do is to retrieve the first key, and the first value and 
>return the first key in scalar context, or the pair first key and first 
>value if in list context. If there are no keys in the hash, it's 
>supposed to return undef in scalar context, but the empty list if in 
>array context. Well, we've got a serious logical problem if the first 
>key in the hash is undef - since returning undef in scalar context is 
>how we're supposed to indicate that there are no keys.
>


--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to