1 / 19

Perl 6 - an Introduction

Perl 6 - an Introduction. Presented by jonasbn Yet Another Perl Monger <jonasbn@io.dk>. Larry Wall. Damian Conway. From Apocalypse to Exegesis. Larry Wall. The inventor of Perl Processes RFCs Writes Apocalypses (1-5). Damian Conway. Inventor of many fantastic modules

barton
Download Presentation

Perl 6 - an Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Perl 6 - an Introduction Presented by jonasbn Yet Another Perl Monger <jonasbn@io.dk>

  2. Larry Wall Damian Conway From Apocalypse to Exegesis

  3. Larry Wall • The inventor of Perl • Processes RFCs • Writes Apocalypses (1-5)

  4. Damian Conway • Inventor of many fantastic modules • Writes Exegesises (3-5)

  5. This Talk • This talk will evolve around the content of Apocalypse 3 VERY much the corresponding Exegesis 3 • Will mostly be about syntax (variables, operators, functions, arrays and hashes) • So lets start with something we know…

  6. Hello World of Perl6! #!/usr/bin/perl use warnings; use strict; print "Hello World of Perl6!\n";

  7. Variables • $_ is a lexical variable • $?, $!, $@ and $^E consolidated into $! • @ARGV changes name to @ARGS

  8. String Concatenation Operator • String concatenation changes from .= to _= $fullname = getFirstname _ getLastname;

  9. The New Dereferencing Operator .

  10. Binary Default Operator // my $debug //= $param{‘debug’} // 0;

  11. Arrays • The ($#) operator referring to the length of an array disappears, or is changed to @array.end or the Perl 6 semi-infinite list @array[1..] • Maybe @array[1..INF]

  12. Arrays #!/usr/bin/perl use Perl6::Variables; my @array = ('Egon', ’Benny', ’Keld'); for (my $i = 0; $i < (scalar @array); $i++) { print "@array[$i]\n"; }

  13. Hashes #!/usr/bin/perl use Perl6::Variables; my %hash = ( 'Fy' => 'Bi', 'Keld' => 'Dirk', 'Pallesen' => 'Pilmark' ); foreach my $key (keys %hash) { print "$key og %hash{$key}\n"; }

  14. Functions • Named parameters • $f is a scalar • $v is an optional scalar • *@array is a list (* == list context asterisk), where @array would be an array or array reference sub func ($f ; $v, *@array) {

  15. Named Parameters Again • Perl 5 (=>) is just a comma • Perl 6 (=>) is an constructor $d = setName(first => ‘Jonas’, last => ‘N.’); sub setName( $pair_ref1, $pair_ref2) { …

  16. Open Function • Open no longer takes a BAREWORD

  17. Enough Talk • We have now briefly touched Perl 6 • Perl 6 is still under development • Perl 6 has a long way to go • Many Apocalyptic writings and Exegesises will follow

  18. Getting Started on Perl 6 • Download Bundle::Perl6 from CPAN • Read the Exegesises

  19. References • ‘And Now for something completely similar’, Article by Damian Conway. SysAdmin, March 2002 Vol. 11, Number 3. • Apocalypse 1, Larry Wall • Exegesis 3, Damian Conway

More Related