in reply to Re: Tiny Perl puzzle
in thread Tiny Perl puzzle
I wasn't even trying to guess what it would really parse as so I just Deparse and run it
$ perl -MO=Deparse print (two + two == five ? "true" : "false") ^Z print two 'two' == 'five' ? 'true' : 'false'; - syntax OK $ perl -MO=Deparse,-p print (two + two == five ? "true" : "false") ^Z print(two (('two' == 'five') ? 'true' : 'false')); - syntax OK $ perl -w print (two + two == five ? "true" : "false") print (...) interpreted as function at - line 1. Unquoted string "two" may clash with future reserved word at - line 1. Unquoted string "two" may clash with future reserved word at - line 1. Unquoted string "five" may clash with future reserved word at - line 1 +. ^Z Name "main::two" used only once: possible typo at - line 1. Argument "five" isn't numeric in numeric eq (==) at - line 1. Argument "two" isn't numeric in numeric eq (==) at - line 1. print() on unopened filehandle two at - line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Tiny Perl puzzle
by davido (Cardinal) on Jun 06, 2014 at 18:43 UTC | |
by Anonymous Monk on Jun 07, 2014 at 07:25 UTC | |
by LanX (Saint) on Jun 07, 2014 at 15:38 UTC | |
by Anonymous Monk on Jun 08, 2014 at 09:17 UTC | |
by LanX (Saint) on Jun 08, 2014 at 13:33 UTC |