return a hash key

2001-10-18 Thread AL H

Let say I have a multikey hash:
$poeple{$first}{$Last}{$MI}{$CITY}
If I am passing values to this hash Is there a function or a way to retrieve 
missing keys from it?
I know that if  (! exists %poeple ->{$first}->{$Last}-{$MI}) will return 
false or true.
I want thes non valid keys temselves to be returned.
Regards

Al

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: return a hash key

2001-10-18 Thread Michael Fowler

On Thu, Oct 18, 2001 at 05:50:33PM +, AL H wrote:
> Let say I have a multikey hash:
> $poeple{$first}{$Last}{$MI}{$CITY}
> If I am passing values to this hash Is there a function or a way to retrieve 
> missing keys from it?
> I know that if  (! exists %poeple ->{$first}->{$Last}-{$MI}) will return 
> false or true.
> I want thes non valid keys temselves to be returned.

There is nothing builtin to do what you want.  You'd have to test each key
to see if it's there.

Also, the syntax %people->{...}, while supported, should not be used.  It
should be $people->{...}.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: return a hash key

2001-10-18 Thread Bob Showalter

> -Original Message-
> From: AL H [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 18, 2001 1:51 PM
> To: [EMAIL PROTECTED]
> Subject: return a hash key
> 
> 
> Let say I have a multikey hash:
> $poeple{$first}{$Last}{$MI}{$CITY}
> If I am passing values to this hash Is there a function or a 
> way to retrieve 
> missing keys from it?
> I know that if  (! exists %poeple ->{$first}->{$Last}-{$MI}) 
> will return 
> false or true.
> I want thes non valid keys temselves to be returned.
> Regards

Actually, 

   ! exists %poeple ->{$first}->{$Last}-{$MI}

is not valid syntax. I assume you meant

   !exists $poeple{$first}->{$Last}->{$MI}

which can be shortened to

   !exists $poeple{$first}{$Last}{$MI}

This expression will auto-vivify $people{$first} and
$people{$first}{$Last} if they don't already exist
(but NOT $poeple{$first}{$Last}{$MI}).

Is this really your data model? Why all the nested
levels of hashes?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: return a hash key

2001-10-19 Thread AL H

>Is this really your data model? Why all the nested
>levels of hashes?
>

Is there another alternative to access data from a database (cvs or sql)
besides using hashes and arrays without nesting?

Al



>From: Bob Showalter <[EMAIL PROTECTED]>
>To: 'AL H' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: RE: return a hash key
>Date: Thu, 18 Oct 2001 16:04:33 -0400
>
> > -Original Message-
> > From: AL H [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, October 18, 2001 1:51 PM
> > To: [EMAIL PROTECTED]
> > Subject: return a hash key
> >
> >
> > Let say I have a multikey hash:
> > $poeple{$first}{$Last}{$MI}{$CITY}
> > If I am passing values to this hash Is there a function or a
> > way to retrieve
> > missing keys from it?
> > I know that if  (! exists %poeple ->{$first}->{$Last}-{$MI})
> > will return
> > false or true.
> > I want thes non valid keys temselves to be returned.
> > Regards
>
>Actually,
>
>! exists %poeple ->{$first}->{$Last}-{$MI}
>
>is not valid syntax. I assume you meant
>
>!exists $poeple{$first}->{$Last}->{$MI}
>
>which can be shortened to
>
>!exists $poeple{$first}{$Last}{$MI}
>
>This expression will auto-vivify $people{$first} and
>$people{$first}{$Last} if they don't already exist
>(but NOT $poeple{$first}{$Last}{$MI}).
>
>Is this really your data model? Why all the nested
>levels of hashes?
>





_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]