|
Perl 6 FAQ - Perl 5 To Perl 6 Migration
This FAQ is part of the Programmer's Heaven Perl 6 FAQ. It answers questions about moving from Perl 5 to Perl 6.What is the best way for a Perl 5 programmer to learn Perl 6?
Perhaps one of the best ways is to take small pieces of Perl 5 that you have written and try translating them into Perl 6. That or try solving the kind of problem you would use Perl 5 to solve using Perl 6.Of course, to get started you will need to read a bit about the new Perl 6 syntax. This FAQ is one good source of information on the changes, and the Perl 6 specification provide much more detailed information.
There are a number of places to turn to for help. One is the Perl 6 forum here at Programmer's Heaven. There is also a perl6-users mailing list; you can subscribe by sending an email to:
perl6-users-subscribe@perl.org
Is Perl 6 backward-compatible with Perl 5?
No. Perl 5 has been a popular and successful language and continues to be as Perl 6 develops. However, there are fundamental issues that need to be addressed in the syntax of the language, and staying backwards-compatible with Perl 5 syntax would have greatly restricted the improvements that were possible. Additionally, the Perl 5 interpreter has grown over the years and become difficult to maintain and add to. Therefore a ground-up design and implementation was required.There are a lot of things that are good about Perl 5, and a lot of the things that are good about it have been retained. Perl 6 is still very much Perl: it's still great for solving the problems you may have used Perl 5 to solve as well as for other problems that Perl 5 was not so well suited to.
Will I be able to use Perl 5 modules with Perl 6?
Yes; this will likely be achieved by embedding a Perl 5 interpreter, which is what Pugs, one of the prototype Perl 6 compilers, does now. The syntax for using a Perl 5 module is:use perl5:Module::Name;
The name of a language followed by a single colon is the general syntax for using a module from another language, and in the future, with the Parrot VM, it should be possible to name various languages there.
Will there be a Perl 5 to Perl 6 translator?
Yes, this is currently under development. It uses a modified version of the original Perl 5 parser to build a syntax tree and then takes that and generates Perl 6 code from it.Does Perl 6 always have "use strict;" turned on, unlike Perl 5?
Not always, just more often. One-liners at the command line, where "-e" is used to specify what to execute, will not have strict turned on. However, it will be on by default everywhere else.Will Perl 6 programs run faster than Perl 5 programs?
There are way too many factors involved in the performance of a program to give a yes or no answer to this. It is safe to say that it will be possible for Perl 6 programs to run somewhat faster than Perl 5 programs. Some of the improvements are:- It will be possible to compile Perl 6 down to Parrot bytecode, meaning you save on the parse/compile phase at the start of each run.
- Perl 6 has an optional type annotations system, which means you can give the compiler hints that allow it to generate more optimal code.
- The Parrot interpreter includes a JIT compiler, meaning certain types of code (especially code doing intensive math) may well run notably faster than under Perl 5.
- Multi-threaded programming should be much more resource-efficient than Perl 5 is.
Back To FAQ List | Next Section
What's next?
Join our Perl 6 Newsletter
Visit our Perl Resources
- Perl 6 Forum
- Perl, PHP & Python zone
- Perl Programming Forum
- Beginners Guide to Perl
- Regex tutorial
- 20 Perl Tips And Tricks
|
|
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
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
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!