in reply to Re^2: Here there be camels!
in thread Here there be cammels!

I do not think is a bug: is a edge case of use of very particular features...
diamond <> never close the handle and __DATA__ is very near to be $0 in this case (if i remember you can seek it and print the main program too). Because you can adjust $. and you had not closed DATA handle you end with the beahviour observed.
from perldata
Text after __DATA__ may be read via the filehandle PACKNAME::DATA , where PACKNAME is the package that was current when the __DATA__ token was encountered. The filehandle is left open pointing to the line after __DATA__. The program should close DATA when it is done reading from it.
PS. thanks for the line directive hint: never eard about..
L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^4: Here there be camels!
by Anonymous Monk on Mar 01, 2015 at 13:04 UTC

    Using DATA was just an example, the same thing happens on a normal filehandle too.

    system 'echo "foo" >/tmp/blah'; open my $fh, '<', '/tmp/blah' or die $!; while (<$fh>) { chomp; warn "<$_>"; } warn "One"; $. = 123; warn "Two"; close $fh; warn "Three"; $. = 456; warn "Four"; __END__ <foo> at - line 3, <$fh> line 1. One at - line 4, <$fh> line 1. Two at - line 6, <$fh> line 123. Three at - line 8. Four at - line 10, <$fh> line 456.

    So LanX is probably right about it being more of a bug than an obscure feature :-)