Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: trying to implement hash table. and getting lots of difficulties. plz help me out..........

by NetWallah (Abbot)
on Oct 10, 2012 at 16:53 UTC ( #998260=note: print w/ replies, xml ) Need Help??


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"

die "$k was not found (slot $h)" unless grep {$k==$_} keys (%{$buckets +[$h][0]});
There are actually 3 keys in the "201" slot.
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


Comment on Re^3: trying to implement hash table. and getting lots of difficulties. plz help me out..........
Download Code
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
    thnk u very much.....

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998260]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-10-21 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (95 votes), past polls