Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I saved "my $thread = Thread.start({ for 1 .. 10 -> $v { say $v }});" from https://docs.perl6.org/language/concurrency#Threads into a file and ran "perl6 file.pl" but get error "Undeclared name: Thread used ..." Any ideas how to fix the problem? (The document doesn't mention using any packages.)

Replies are listed 'Best First'.
Re: Perl6 Threads
by morgon (Priest) on May 04, 2016 at 17:17 UTC
    I would assume that you need a "use Thread;"before your code.

    But I am only guessing, I have never really used perl6.

      Please tell us what perl6 --version gives you
        perl6 version 2013.12 built on parrot 5.9.0 revision 0
      Then the message is "Could not find Thread in any ... (directories)"
        Your initial code works as is.

        I've just tried it with the rakudo from Debian testing (2016.04).

        So I assume there is something wrong with your installation.

        I'd do a clean install of the latest rakudo, otherwise you just end up chasing non-issues due to a broken install...