in reply to Re: Recognizing Perl in text
in thread Recognizing Perl in text

I'd say all extracted lines which pass a syntax check with perl -c without error are per definition perl code.
Really?
$foo=1
What language is that? It could be perl, but it could also be PHP, and I expect a few other things. What language it is may perhaps be divined from the surrounding lines of code - it's certainly more likely to be perl if the lines before and after also match your rule.

Replies are listed 'Best First'.
Re^3: Recognizing Perl in text
by LanX (Saint) on Jan 06, 2011 at 12:28 UTC
    > It could be perl, but it could also be PHP

    so what?

    Of course it is Perl and PHP and what ever else, like the words "name","hand" and "finger" are German AND English (well modulo capitalization).

    The OP didn't ask about distinguishing Perl from other languages, but from text.

    Cheers Rolf

      Be careful: so is 'Gift'. ;-)

      The person I was responding to said "I'd say all extracted lines which pass a syntax check with perl -c without error are per definition perl code". This is demonstrably false.

        LOL...

        This person didn't say (or mean) "exclusively perl code"!

        BTW it's also valid JS and Ruby code! :)

        Cheers Rolf

        UPDATE: this is the one instance of a doublepost which shouldn't be reaped. Sorry for the inconvenience! :)