3 ms·
Apparently, Perl is that crazy. See https://news.ycombinator.com/item?id=5770531 https://news.ycombinator.com/item?id=5770531 Basically, you can't always parse
by scott_s 12y ago
Apparently, Perl is that crazy. See https://news.ycombinator.com/item?id=5770531 https://news.ycombinator.com/item?id=5770531
Basically, you can't always parse a Perl program without running it. There is a subset that you can, not not everything.
- haberman 12y ago> Basically, you can't always parse a Perl program without running it. That is true, but what the grandparent said is not: https://news.ycombinator.com/item?id=8626454 https://news.ycombinator.com/item?id=8626454 To expand on this, I think a succinct way of summarizing the issue is: you might have to run BEGIN blocks in Perl to parse the non-BEGIN-block part of the program. The canonical example of this is: BEGIN { if(arbitrary_function()) { eval "sub whatever() { }; 1" or die $@; } else { eval "sub whatever { }; 1" or die $@; } } # The parsing of this line depends on the result of arbitrary_function() whatever / 25 ; # / ; die "this dies!"; arbitrary_function() can be anything, so the only way to parse the rest of the program is to actually run arbitrary_function().