I think the getkey() function is just an example. In this case, it's a function that somehow returns the right key to put in %hash for the given value. Note the preceding paragraph:
[...] And
%hash = map { getkey($_) => $_ } @array;
is just a funny way to write
%hash = ();
foreach $_ (@array) {
$hash{getkey($_)} = $_;
}