in reply to Recognizing Perl in text
Look for the “idioms” of the language, such as keywords like sub and the presence of identifiers beginning with $, @, %, $$, ->. Score the text in favor of the various candidate languages you think might be there, giving various weights to the idioms that you see, and take the highest candidate score.
Some idioms are just-about “show stoppers.” For example, the presence of <?...?> pretty well screams (ick...) “PHP.”
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Recognizing Perl in text
by Anonymous Monk on Jan 06, 2011 at 17:47 UTC |