Matthew Walton wrote:

Thomas A. Boyer wrote:

Matthew Walton wrote:

That could be problematic, because if Perl 6 sees something like:

my %myhash;
%myhash{'foo'} = 'bar';

It's going to think 'ahah', perl 5'. Because it doesn't contain any Perl 6 keyword (such as 'module' or 'class'), as Mark said.

But then trying to process that as Perl 5 will result in an error. This doesn't seem particularly sane to me. Will we have to say


use 6;

on all Perl 6 programs to avoid this kind of thing?

Forgive me if I'm missing something obvious here.

The original question was "how do I label my code as Perl 5?" The correct answer, according to Apocalypse 1, is to start your source with "package." If you didn't want to put your code in a package, then start it with "package main".

The other question was "how do I label my code as Perl 6?" The correct answer, according to Apocalypse 1, is to start your source with "module" or "class".

Here is the relevant paragraph from the apocalypse:
 I hereby declare that a |package| declaration at the front of a
 file unambiguously indicates you are parsing Perl 5 code. If
 you want to write a Perl 6 module or class, it'll start with
 the keyword |module| or |class|. I don't know yet what the exact
 syntax of a module or a class declaration will be, but one
 thing I do know is that it'll set the current global namespace
 much like a |package| declaration does.

=thom
A lot of people become pessimists from financing optimists.

Reply via email to