Perl 6 new syntax

This is an incomplete list just to bring you the small overview for the Perl 6 new syntax.

  1. Global variables use twigil. It is the second character in the variable name.

Was: $ENV{FOO}

Now: %*ENV

  1. eval {} is now try {}

  2. foreach becomes for

  3. for becomes loop

4.no parens on control structure conditions (Larry you did it again)

Was: if ($a < $b) { … }

Now: if $a < $b { … }

  1. string concatenation is now done with ~.

  2. still the same contexts: void, item (scalar) and list, but operators can force the special context

  3. the command-line arguments are now in @ARGS</strong>, not @ARGV. Note the * twigil because @ARGS is a global.

  4. The double-underscore keywords are gone

LINE is gone

and now:  $?LINE

FILE is gone

and now: $?FILE

PACKAGE is gone

and now: $?PACKAGE

END is gone

and now: =begin END

DATA is gone

and now =begin DATA

  1. @array.elems for number of elements in an array:

Was: $#array+1 or scalar(@array)

10 @array.end to get the index of last element in an array:

Was: $#array

9-10 combined. to get the last element of the array@array[@array.end]

Was: $array[$#array]

tags: & category: -