As others already said, no. Here's what the compiler backend B (B::Terse) says, running

perl -MO=Terse -le 'for(<>){print}' perl -MO=Terse -le 'while(<>){print}'

substituting the addresses with 0x? and running 'vimdiff for while':

==================== for ====================|=================== while ===================
LISTOP (0x?) leave [1]                       |  LISTOP (0x?) leave [1]
  OP (0x?) enter                             |    OP (0x?) enter
  COP (0x?) nextstate                        |    COP (0x?) nextstate
  BINOP (0x?) leaveloop                      |    BINOP (0x?) leaveloop
    LOOP (0x?) enteriter                     |      LOOP (0x?) enterloop
      OP (0x?) null [3]                      |  ---------------------------------------------
      UNOP (0x?) null [147]                  |  ---------------------------------------------
        OP (0x?) pushmark                    |  ---------------------------------------------
        UNOP (0x?) readline [2]              |  ---------------------------------------------
          PADOP (0x?) gv  GV (0x?) *ARGV     |  ---------------------------------------------
      PADOP (0x?) gv  GV (0x?) *_            |  ---------------------------------------------
    UNOP (0x?) null                          |      UNOP (0x?) null
      LOGOP (0x?) and                        |        LOGOP (0x?) and
        OP (0x?) iter                        |            UNOP (0x?) defined
---------------------------------------------|              UNOP (0x?) null
---------------------------------------------|                UNOP (0x?) null [15]
---------------------------------------------|                  PADOP (0x?) gvsv  GV (0x?) *_
---------------------------------------------|                UNOP (0x?) readline [2]
---------------------------------------------|                  PADOP (0x?) gv  GV (0x?) *ARGV
        LISTOP (0x?) lineseq                 |            LISTOP (0x?) lineseq
          COP (0x?) nextstate                |              COP (0x?) nextstate
          LISTOP (0x?) print                 |              LISTOP (0x?) print
            OP (0x?) pushmark                |                OP (0x?) pushmark
            UNOP (0x?) null [15]             |                UNOP (0x?) null [15]
              PADOP (0x?) gvsv  GV (0x?) *_  |                  PADOP (0x?) gvsv  GV (0x?) *_
          OP (0x?) unstack                   |              OP (0x?) unstack

which shows,that for gobbles up all lines (LOOP enteriter) to process each (OP iter) after that, whereas the while loop (LOOP enterloop) processes readline and print in the loop body (LOOP enterloop).

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re: Internally, how do for() and while() differ? by shmem
in thread Internally, how do for() and while() differ? by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.