in reply to Getting data out of __DATA__ and __END__

Because the magical assignment of <handle> to $_ only happens in a regular while loop, not in a statement modifier. Update: that's not correct.

Write while (<DATA>) { @ary = split (" ",$_) }; and split will find something in $_ to operate on. Of course, you're still only going to print the result of the last line of data. If that's a blank line...

—John

Replies are listed 'Best First'.
Re: Re: Getting data out of __DATA__ and __END__
by jj808 (Hermit) on Sep 10, 2001 at 18:59 UTC
    I beg to differ.

    Try this code:

    print while (<DATA>); __DATA__ one two three four five six seven eight
    $_ is assigned when using while as a statement modifier.

    But as you said, if $_ is a blank line...

    JJ