|
Perl 6 FAQ
Welcome to the Programmer's Heaven Perl 6 FAQ, part of our Perl Area.Perl 6 has been six years in the making and is finally at the stage where you can try it out and begin to learn it. Whether you have questions about what has changed in Perl 6 relative to Perl 5 or are coming to Perl 6 never having looked at Perl before, we hope that this FAQ will answer some of your questions about this exciting new language.
Before digging into the FAQ, you may wish to view our Perl 6 Quick Start Guide, which will walk you step by step through writing and running your first Perl 6 program. See also our Perl 6 Newsletter and Perl 6 Forum.
FAQ Last Updated: 14th November 2007
Getting Started
- Can I write and run Perl 6 programs now?
- Can I use Perl 6 in production now?
- What do I need to write and run Perl 6 programs?
- How can I contribute to Perl 6 development?
- Where can I get Perl6 help?
- Are any books available about Perl 6?
- How can I make suggestions for additions to this FAQ?
Perl 5 To Perl 6 Migration
- What is the best way for a Perl 5 programmer to learn Perl 6?
- Is Perl 6 backward-compatible with Perl 5?
- Will I be able to use Perl 5 modules with Perl 6?
- Will there be a Perl 5 to Perl 6 translator?
- Does Perl 6 always have "use strict;" turned on, unlike Perl 5?
- Will Perl 6 programs run faster than Perl 5 programs?
Related Projects
Basic Constructs
- How do I print some text?
- How do I write an if block?
- How do I write a for (;;) style loop?
- How do I loop over the elements of an array?
- How do I write a while loop?
Variables And Scoping
- How does the use of sigils differ between Perl 5 and Perl 6?
- What is a lexical variable?
- What is a package variable?
- What is a state variable?
- What is a temporary (temp) variable?
- What is a hypothetical (let) variable?
- What is a global variable ($*)?
- What is binding (the ":=" and "::=" operators)?
- Where did all those crazy special variables like $$, $/, $! and so on go?
Operators
- Does Perl 6 really have unicode operators?
- What do the operators for arithmetic and logical operations look like in Perl 6?
- What do the operators for comparisons look like?
- What do string operations (such as concatenation) look like in Perl 6?
- How is the ternary operator (" ? : ") written in Perl 6?
- What is the "~~" operator, or the smart-match operator, or where on earth did Perl 5's "=~" go?
- What is the "//" (defined-or) operator?
- What do bitwise operations look like in Perl 6?
- What are the number, string and boolean coercion operators (prefix "+", "~" and "?")?
- What is operator chaining?
- What is a list operator (or how is "5, 6, sort 8, 7" parsed)?
- What is the zip operator?
- What is the cross operator?
- What is the hyper ("»...«" or ">>...<<") meta-operator?
- What happens if hyper operators are applied to lists of lists?
- What happens if the lists on either side of a hyper operator are of different lengths or dimensions?
- What is the reduce ("[...]") meta-operator?
- What is the cross meta-operator?
Subroutines
- How do I use the new parameter list syntax?
- How do I pass by reference?
- How do I pass by value?
- How do I get Perl 5 behavior (parameters in @_)?
- What are positional and named parameters?
- What is a slurpy parameter?
- How do I denote that a positional parameter is optional?
- How do I specify a default value for an optional positional parameter?
- How do I specify that a named parameter is required?
- How do I specify a default value for a named parameter?
- What constraints are there on ordering of positional, named and slurply parameters?
- What is a pointy block (or pointy sub, or that "->" thing)?
Object Orientation
- How does object orientation in Perl 6 differ from Perl 5?
- Does Perl 6 force me to write in an object oriented fashion?
- How do you define classes?
- How do you define the attributes/fields/properties for a class?
- How do you define methods?
- How do you inherit from a class?
- How do you instantiate a class?
- How do you call a method?
- How do I translate a typical Perl 5 class into Perl 6?
- What is a role?
- When should I use roles rather than classes?
- How do I compose roles at compile time?
- Can I use a role like an interface?
- Can I use a role like a mix-in?
Regexes and Grammars
- Why the name "Regex"? Why not just say "Regular Expression"?
- Argh, they changed the regex syntax! How do I use the Perl 5 regex syntax in Perl 6?
- How is whitespace interpreted in Perl 6 regexes (or how do I match whitespace)?
- What is the syntax for quantifiers?
- What is the syntax for alternation?
- What is the syntax for character classes?
- How do I write modifiers on regexes?
- Where did the single-line (s) and multi-line (m) modifiers go?
- What is the syntax for groups?
- How do I use captures?
- How do I do named captures?
- How do I match the contents of a string literally in a regex (or are strings taken as part of the regex syntax in Perl 6)?
- How do I give a regex a name so it can be re-used many times in a program?
- How do I "insert" one named regex into another?
- What is a grammar?
- Where can I find the Perl 6 regex specification?
Junctions
- What is a junction?
- What is the all (&) junction?
- What is the any (|) junction?
- What is the one (^) junction?
- What is the none junction?
- What happens if I perform an operation on a junction?
- What happens if I call a method on a junction?
- What happens if I pass a junction as a parameter?
Files And Environment
- How do I access the environment variables?
- How do I open files?
- How do I read an entire file into a variable?
- How do I read a line from a file?
- How do I iterate over the lines in a file?
- How do I write to a file?
- How do I close a file?
- How do I delete a file?
Types
- How do I write type annotations in Perl 6?
- How do I specify the parameter and return types for a subroutine or method?
- What is a refinement type, or what do the "subset" and "where" keywords do?
- Can I use anonymous refinement types in sub and method signatures, or what is the "where" keyword doing in a signature?
Multiple Dispatch
- What is multiple dispatch?
- How do I write multi-subs?
- How do I write multi-methods?
- How do I state that only some parameters should be used for multiple dispatch?
Concurrency
- What will threading look like?
- What is Software Transactional Memory (STM)?
- What will using STM look like in Perl 6?
- How is Perl 6 providing support for data parallelism?
Keep Posted!
This FAQ may answer a lot of questions already, but there are plenty more that are still unanswered! We will be updating this FAQ over time to include more answers; particularly answers to your suggestions!About The Author
Jonathan Worthington works at Programmer's Heaven, hacking on code in a multitude of languages and writing numerous articles. He holds a degree in Computer Science from the University of Cambridge, England, and his main areas of interest are programming language design and semantics, compilers, virtual machines and type theory. He has worked in web development for a number of years and contributes to Parrot, the runtime for the next version of Perl and other dynamic languages. In his free time Jonathan loves to travel, especially to places with beautiful scenery where he can go walking.What's next?
Join our Perl 6 Newsletter
Visit our Perl Resources
- Perl 6 Forum
- Perl Zone
- Perl Programming Forum
- Beginners Guide to Perl
- Regex tutorial
- 20 Perl Tips And Tricks
- Programmer's Heaven Glossary
|
|
riya
From India (Report as abusive) |
"Very Useful" this faqs made to know about many things unknown and it helped me a lot |
| View all Rate and comment this article |
Sponsored links
SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
Add complete SSH and SFTP support to your .NET framework application
Virtual File System SDK
Create your own file systems in Windows and .NET applications
Create your own file systems in Windows and .NET applications
PureCM Software Configuration Management
Version control and integrated issue tracking - powerful and easy to use. Get your FREE trial now!
Version control and integrated issue tracking - powerful and easy to use. Get your FREE trial now!
CSTSOFT Instrumentation .NET & ActiveX Components
A collection of 13 instrumentation .NET/ActiveX/VCL components including Gauge,Knob,LED,Trend etc.
A collection of 13 instrumentation .NET/ActiveX/VCL components including Gauge,Knob,LED,Trend etc.
Software Localization Tool Sisulizer
Localize DotNet, C++ Builder, Delphi, C/C++, Visual Basic & Java apps & html help. Try Sisulizer now
Localize DotNet, C++ Builder, Delphi, C/C++, Visual Basic & Java apps & html help. Try Sisulizer now