Think about Loose Coupling | |
PerlMonks |
Re: Are pseudo-hashes worth the effort?by autark (Friar) |
on Dec 13, 2000 at 05:54 UTC ( [id://46369]=note: print w/replies, xml ) | Need Help?? |
"Is pseudo-hashes usefull ?" - You are certainly not the first person
to ask that question :-)
I don't remember the exact reason why that feature was introduced. However, some of the pro opinions was:
This would produce the following: Aha! So delete $a[1] must be the same as $a[1] = undef then ? Let's check that statement: And indeed, this invalidates my previous statement. For the output is: So delete $a[1] is not the same as $a[1] = undef. Hm, isn't that strange ? Well, the story is this, when we use undef we set the variable to the special value undef. When we use delete it does not set our variable to the special value undef, but to the special special value called uninitialized. Uninitialized means that the variable has not been set at all. This may seem strange but then again, pseudo-hashes and delete/exists on arrays is an experimental feature. (delete and exists on arrays was added in 5.6 IIRC). If you ask me it is a good reason pseudo-hashes is experimental, if you are not interested in my opinion, then maybe the opinion of our current pumpkin for the development track of perl (5.7) might interest you :-) Autark.
In Section
Seekers of Perl Wisdom
|
|