On Jun 14, 6:29 am, [EMAIL PROTECTED] (Mathew Snyder) wrote:
> I'm building a hash using values from a database backend to an application we
> use in house.  The application has a field which contains a customer name.  
> This
> values is supposed to be set by the person handling the work but sometimes
> doesn't get done.  This leaves a NULL value in the database which, in turn,
> leaves me with a null key in my hash.
>
> I've tried resetting it by assigning the value to another key so I can delete
> the element but so far nothing has worked.  I've tried to access it with
> $hash{}, $hash{""}, and $hash{''}.  None of these will allow me to access the 
> data.
>
> I could probably reassign it through more complicated means but that would
> require creating objects and accessing methods I'm not familiar with.  If 
> anyone
> knows an easier way to access a null key I'd appreciate hearing it.

Please post a short but complete script that demonstrates your issue.
There is no such thing as a "NULL" key in your hash.  Hash keys are
strings.  The stringified version of undef() is the empty string.
Therefore, accessing it via $hash{""} should work.

Have you tried examining your hash using Data::Dumper, to see what's
*really* in it?

use Data::Dumper;
print Dumper(\%hash);

What is the output of these two statements?

Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to