in reply to Re^2: trying to implement hash table. and getting lots of difficulties. plz help me out..........
in thread trying to implement hash table. and getting lots of difficulties. plz help me out..........
If you want to fail the search when the item is not found, you need to add the following line before the final "print"
If you run the code I posted, it will show all three.
If you wanted to show only the matched key, you can use a grep statement , very similar to the one above.
There are actually 3 keys in the "201" slot.die "$k was not found (slot $h)" unless grep {$k==$_} keys (%{$buckets +[$h][0]});
If you run the code I posted, it will show all three.
If you wanted to show only the matched key, you can use a grep statement , very similar to the one above.
I hope life isn't a big joke, because I don't get it.
-SNL
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: trying to implement hash table. and getting lots of difficulties. plz help me out..........
by Priti24 (Novice) on Oct 11, 2012 at 06:08 UTC |
In Section
Seekers of Perl Wisdom