Gossamer Forum
Home : General : Perl Programming :

Advice with DB structure

(Page 2 of 2)
> >
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
Sorry, my fault! Blush I wasn't concentrating. Here's the best I can get:

Code:
print $foo->{Key1}[0]{SubKey1}{Subkey2}[0]{Bar};

?

- wil
Quote Reply
Re: [Wil] Advice with DB structure In reply to
uhuh Tongue

Well obviously it becomes easy when I've already shown you that code...haha.

Last edited by:

PaulW: Nov 30, 2001, 7:47 AM
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
No. I did that myself, and it is actually different from your code. I have omitted a =>.

- wil
Quote Reply
Re: [Wil] Advice with DB structure In reply to
Ok to prove it wasn't a fluke, try and print 'Im not flukey!' :)

Code:

$hash = {
[
[ {} ],
[ {
{ foo => { { bar => [ { foo => [ { bar => 'Im not flukey!' } ] } ] } } }
} ],
]
};

That should keep you busy :)
Quote Reply
Re: [Wil] Advice with DB structure In reply to
>>I have omitted a =>.<<

You mean ->

But no you haven't - it's exactly the same.
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
Yeah, very busy because there's something definitily wrong here... even anonymous hash wouldn't contains odd number of elements.

- wil
Quote Reply
Re: [Wil] Advice with DB structure In reply to
Actually it's valid.

>>even anonymous hash wouldn't contains odd number of elements.
<<

Sorry?
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
Hash have to contain at least two elements.

Code:
$hash= { ..., [..] };


And you've got an array reference as a KEY in a hash?! That is most definitily broken.

- wil

Last edited by:

Wil: Nov 30, 2001, 8:39 AM
Quote Reply
Re: [Wil] Advice with DB structure In reply to
Haha, where do you get this information from?

You crack me up sometimes :)

If it was broken you'd get a 500.

Last edited by:

PaulW: Nov 30, 2001, 8:45 AM
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
No. That is most definitily definitily broken. You simply can not have an array reference as a key in your hash.

- wil
Post deleted by PaulW In reply to
Quote Reply
Re: [Wil] Advice with DB structure In reply to
You are wrong

Place your bets please........

You simply can not have an array reference as a key in your hash.


$hash = { [ 1 ] => 'Yo' }; TongueTongue

print $hash->{[0]};

Last edited by:

PaulW: Nov 30, 2001, 8:50 AM
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
Why delete this?

Code:
$hash = { bar =>
[ [ {} ],
[ { { foo => { { bar => [ { foo => [ { bar => 'Im not flukey!' } ] } ] } } }
} ],
]
};

- wil
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
In Reply To:
Ok to prove it wasn't a fluke, try and print 'Im not flukey!' :)

Code:

$hash = {
[
[ {} ],
[ {
{ foo => { { bar => [ { foo => [ { bar => 'Im not flukey!' } ] } ] } } }
} ],
]
};

That should keep you busy :)

sorry but I am referring to the above post and it just does NOT make any sense. That code is wrong and there can be no such data structure as what you're trying to imply.

- wil
Quote Reply
Re: [Wil] Advice with DB structure In reply to
>>sorry but I am referring to the above post and it just does NOT make any sense<<

Nope, you said:


You simply can not have an array reference as a key in your hash.


...and in the words of Ned Flanders, you are diddly dong.

Last edited by:

PaulW: Nov 30, 2001, 8:54 AM
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
No I don't think I am wrong on that point.

But you are wrong. Have you got that impossible hash to work?

It just doesn't make any sense!

- wil
Quote Reply
Re: [Wil] Advice with DB structure In reply to
>>sorry but I am referring to the above post and it just does NOT make any sense. That code is wrong and there can be no such data structure as what you're trying to imply.
<<

I implied it was valid code, not that it would work. Tongue

For example, compiling it doesn't cause an error.
Quote Reply
Re: [Wil] Advice with DB structure In reply to
>>No I don't think I am wrong on that point.
<<

I just gave you an example proving your point to be invalid...

$hash = { [1] => 'Duh' };

Last edited by:

PaulW: Nov 30, 2001, 9:11 AM
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
Try this instead, Paul. Now I have a hash reference as a hash key. Perhaps you added an extra layer by mistake? Look at the bits in red.

Code:
$hash = {
bar => [
[ {} ],
[
{
{

foo => {
{
bar => [
{
foo => [
{
bar => 'Im not flukey!'
}
]
}
]
}
}
}
}
],
]
};

Now that's a sensible data strucutre! When you correct your data structure, I can try and access it again :-)

- wil
Quote Reply
Re: [Wil] Advice with DB structure In reply to
Haha it was never intended to work. I gave you something that I knew you couldn't tell me would cause an error but I also knew you'd never figure out how to print "Im not flukey"

Ah you are an easy target :)
Quote Reply
Re: [Wil] Advice with DB structure In reply to
Go on then, tell me how to print it using your code.

Last edited by:

PaulW: Nov 30, 2001, 9:09 AM
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
Um. I've just told you and showed you where your error was. I stated right from the beginning - youre example is not a valid data structure.

- wil
Quote Reply
Re: [Wil] Advice with DB structure In reply to
Don't worry yourself about it dude, it's not even important.

I'm going to go and do something more productive anyway.


Last edited by:

PaulW: Dec 1, 2001, 5:24 AM
Quote Reply
Re: [PaulW] Advice with DB structure In reply to
I'm not worrying. I'm just recovering from a hangover :-\.

Why post me a puzzle that could not be answered? Did you know that the data structure you posted was invalid?

- wil
> >