Perl code that is syntactically correct only on Fridays
1–10 of 233 posts
Re: Perl code that is syntactically correct only on Fridays
#2Re: Perl code that is syntactically correct only on Fridays
#3Re: Perl code that is syntactically correct only on Fridays
#4 if day_of_week is "Friday"
eval(piece_of_incorrect_code)
else
do_sane_operationRe: Perl code that is syntactically correct only on Fridays
#5This leverages Perl's BEGIN block which runs before the main part of the code. I suppose the same fun could be had in other languages: if day_of_week is "Friday" eval(piece_of_incorrect_code) else do_sane_operation
Re: Perl code that is syntactically correct only on Fridays
#6I have written code that only works in winter because of daylight saving times and some unfortunate date conversions, but having a temporary correct syntax is really a new high.
I had a "switch(moon_phase)" and forgot one of the cases... And the Android app was in debug mode, so any uncaught exception brought the whole thing down.
Re: Perl code that is syntactically correct only on Fridays
#7I have written code that only works in winter because of daylight saving times and some unfortunate date conversions, but having a temporary correct syntax is really a new high.
I have written code (at work) that crashes when the moon is in a specific phase. I had a "switch(moon_phase)" and forgot one of the cases... And the Android app was in debug mode, so any uncaught exception brought the whole thing down.
Re: Perl code that is syntactically correct only on Fridays
#8Re: Perl code that is syntactically correct only on Fridays
#9Perl Cannot Be Parsed: A Formal Proof (2008) https://news.ycombinator.com/item?id=5770531
Re: Perl code that is syntactically correct only on Fridays
#10Unfortunately, the intern only worked the mornings, so it took several days of back and forth before the bug could be finally put to rest.