in reply to __DATA__ Inconsistency

The only way I can get previous values of $_ printed is to slightly modify the loop:
use warnings; use strict; my $test = qq(); $_ = 'xxxx'; do{$test = $test . $_ } while (<DATA>); print "$test"; __DATA__ Hello there. This is me.
Are you perhaps doing that?

Replies are listed 'Best First'.
Re^2: __DATA__ Inconsistency
by bichonfrise74 (Vicar) on Oct 04, 2008 at 03:41 UTC
    It is very possible that I'm doing what you've just written. But the code is too long for me to post here. Anyway, thanks for all your inputs. I really appreciate it.
      do BLOCK while EXPR;

      is uniquely special case of

      EXPR while EXPR;

      The do variant is a bottom tested loop. The loop body will always execute at least once, and will do so before executing the condition expression.