in reply to [untitled node, ID 183102]
But, this won't work if you have duplicate elements ... :( neat anyways.use strict; my @array = (13, 27, 4, 18, 12, 6); my %hash; @hash{@array} = (0..$#array); my $index = $hash{18}; print "should be 18: ", $array[$index], "\n"; print "should be 4: ", $array[$index-1], "\n"; print "should be 12: ", $array[$index+1], "\n";
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|