in reply to Reading from <DATA> in import/BEGIN block

use happens at compile time, directly after the use-directive is parsed. At that time the parser hasn't even seen the __DATA__.

So you have to open the file file from which your import routine is called (caller should give you that information, I think), and parse it yourself, looking for a line that matches ^__DATA__$.

Or you simply retract from the idea of wanting to use DATA at BEGIN-time.

Perl 6 - links to (nearly) everything that is Perl 6.