There are several defined ways of differentiating scripts as a whole. A minimal approach allows for a bare literal in void context at the beginning:
in reply to Re^6: Parrot Monks? (one ring)
in thread Parrot Monks?
5; print "I'm Perl 5 code\n";
Or if you want to make sure strictness is on, you use
6; say "I'm Perl 6 code";
Those are okay for the script as a whole, but I hate to think about what happens when people start cutting and pasting snippets. Certainly Perl 6 could disallow snippets
starting with "5;", but Perl 5 would currently
accept a "6;" unless you had warnings turned on. One could go with "5:" and "6:" instead, but that's a syntax error in Perl 5 currently.
Of course, there's always the tried and true:
print "I'm Perl 5 code\n"; # Perl 5
But that doesn't help much with cut-and-paste errors...
say "I'm Perl 6 code"; # Perl 6