Syntactic Confectionery Delight PerlMonks

### Comment on

 Need Help??
Your structure and logic is much more complicated than necessary, but I have preserved it, and made a few corrections. Try this one:
```use strict;
use warnings;
use Data::Dumper;

my %ex = (
37 => "p" , 41 => "t",
23 => "s" , 52 => "m",
44 => "a" , 65 => "q",
26 => "d" , 88 => "o" ,
99 => "g" , 100 => "l" , 101 => "f" , 201 => "i"
);
my @buckets = ( [],[],[],[],[],[],[],[],[],[] );
sub perlhash
{
my \$k = shift @_;
my \$hash = 0;
\$hash = (\$k % 10);
return \$hash;
}

while(my (\$k , \$v) = each(%ex)) {
my \$hash = perlhash(\$k);
my \$ch = \$buckets[\$hash];
my \$entry;
# print Dumper \$buckets[\$hash];
if(scalar @{\$ch} == 0){
\$entry = {\$k => \$v};
}else{
\$entry = \$ch->[0];
\$entry->{\$k} = \$v ;
next;
}
push @\$ch , \$entry;
}
print Dumper \@buckets;

print "enter a key u want to search";
chomp(my \$k = <STDIN>);
my \$h = perlhash(\$k);
print "The Key in Slot \$h is " .  join (",",keys (%{\$buckets[\$h][0]})
+) . "\n" ;
[download]```

I hope life isn't a big joke, because I don't get it.
-SNL

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Please read these before you post! —
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?
• See Writeup Formatting Tips and other pages linked from there for more info.
• Log In?
 Username: Password:

What's my password?
Create A New User
Chatterbox?
and the fog begins to lift...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (18)
As of 2017-07-26 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
I came, I saw, I ...

Results (395 votes). Check out past polls.