PERL6 revolutionary reform relative to PERL5

Source: Internet
Author: User
Keywords Perl6
Tags community environment find install installation perl6 virtual machine world

July 19, 2000, in a boring and dreary political organization meeting, Jon Orwant stood aside for a few minutes, then calmly went to the coffee table, picked up a cup and threw it across the wall, and said, "We have to find a way to motivate the community, or it's over, we're getting bored, To do something else. I don't care what you do, but you have to do something big. And then he turned around and walked, and this incident triggered the flames of Perl6 's birth. After 10 years of sharpening, July 29, 2010, PERL6 's first implementation version of Rakudo Star finally released, the once burdened camel on the road.

PERL5 is a C-write core, although already very mature, but the core code is too large, full of various difficult to understand the call, and multithreading, Unicode support is not good, Perl6 relatively Perl5 made a revolutionary change, in addition to the more perfect support thread, Unicode, Reliable signal control has been added at the start of the design, the new kernel is smaller, faster, and the external extension API is clearer, and in the past binary compatibility issues have been completely resolved.

START

Install PERL6, you can download http://rakudo.org/how-to-get-rakudo/from the following URL, installation steps are as follows:

Install Perl6

$ cd rakudo$ perl configure.pl--gen-parrot--gen-nqp$ make$ make install

Parameter –gen-parrot is actually a call to SVN or git to generate the appropriate parrot to compile it, parrot is Perl6 Perl6 in the related proposal, which means that Perl programs will be executed on Machine, The program is faced with a common cross-platform Virtual Machine environment, regardless of the OS environment you are facing, just like the VMs used by Java,. NET. Parameter-gen-nqp will download a copy of the NQP,NQP is a small Perl6 compiler used to build Rakudo,rakudo is used to Parrot the compiler on the virtual machine.

After installation, go to the installation directory and run./PERL6, when you see the >, you enter the Rakudo environment, you can perform something to see Rakudo response, such as:

Run Perl6

$./perl6>say "Hello world!"; >hello world!

And in Perl5, running./perl directly in the current state, will not enter the user interaction state.

Variables and types

Array

PERL6 arrays and hashes are defined without parentheses, such as:

Array definition in PERL6

@a = "Hello", "world"; dour @a;

Output:

Hello

Here, the dour function is a newly introduced function in Perl6, which is to print one line of text to the terminal.

Hash

Access to the hash value in Perl6, if the key value is in double quotation marks, the {} is required, and if the double quotes are not used, the <> is required;

Hash definition in Perl6

My%a = "a" => 1, "second" => 2, "third" => 3;say "%a" "a"};say%a<second>

Output:

12

If you do not use the => symbol to define the hash, you can also use the alternate Word method, as follows:

The method of auxiliary words

My%bar =: I (1),: Second (2),: Third (3);

The Perl6 method provides a numerical name, which is used not only in hash but in many places.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.