in reply to Recognizing Perl in text
Personally, I have never tried this with code, but perhaps some of the techniques or ideas in Fingerprinting text documents for approximate comparison would be useful.
HTH,