http://www.perlmonks.org?node_id=427197


in reply to Difference between 'print while' and 'while print'

You should probably read perldoc perlsyn, looking at the sections entitled "Simple Statements" and "Compound Statements". This will explain the difference in syntax. The short of it is that "print while (CONDITION);" is a simple statement (print) with a "modifier" (while), whereas "while(CONDITION){print}" is a compound statement, consisting of the while (and its associated CONDITION) followed by the BLOCK of code to be executed. It's a purely syntactic difference.

--
edan

  • Comment on Re: Difference between 'print while' and 'while print'