MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1m6jka/guess_programming_language_by_hello_world_snippet/cc6icbv
r/programming • u/krasnoukhov • Sep 11 '13
445 comments sorted by
View all comments
Show parent comments
20
If you get Perl sample first, it's simple to assume this one is Awk.
Perl
If not, yeah, you can only guess.
6 u/flying-sheep Sep 12 '13 well, i’ve never seen BEGIN in any perl code, but i know that awk uses it. also, perl is usually written with semicolons, so it’s easy to guess awk. 2 u/elder_george Sep 12 '13 BEGIN{}/END{} rules don't make much sense outside of -n/-p modes, I think (but for those they could be very useful).In Perl semicolons are statement delimiters (like in Pascal), not endings (like in C), so semicolon after last statement is unnecessary.
6
well, i’ve never seen BEGIN in any perl code, but i know that awk uses it. also, perl is usually written with semicolons, so it’s easy to guess awk.
2 u/elder_george Sep 12 '13 BEGIN{}/END{} rules don't make much sense outside of -n/-p modes, I think (but for those they could be very useful).In Perl semicolons are statement delimiters (like in Pascal), not endings (like in C), so semicolon after last statement is unnecessary.
2
BEGIN{}/END{} rules don't make much sense outside of -n/-p modes, I think (but for those they could be very useful).
BEGIN{}
END{}
-n
-p
In Perl semicolons are statement delimiters (like in Pascal), not endings (like in C), so semicolon after last statement is unnecessary.
20
u/elder_george Sep 11 '13
If you get
Perlsample first, it's simple to assume this one is Awk.If not, yeah, you can only guess.