in reply to Hash slice to get DB values - include undefined values?
This already happens as the code below shows:
Undef is returned as with any hash lookup where the key is undefined. BTW I wrote a module called Tie::Hash::Trie (which I have yet to upload anywhere, life got in the way :-) which amongst other things alows this to be changed to any arbitrary value. Let me know if you want to see.my %hash=(a=>1,b=>2,c=>3); my @list=@hash{qw(a b c d e f)}; print "\t$_:",defined $list[$_] ? $list[$_] : "undef" foreach 0..$#lis +t; __END__ 0:1 1:2 2:3 3:undef 4:undef 5:undef
Yves / DeMerphq
--
This space for rent.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hash slice to get DB values - include undefined values?
by George_Sherston (Vicar) on Dec 11, 2001 at 19:55 UTC | |
by demerphq (Chancellor) on Dec 11, 2001 at 20:00 UTC |