Perl Programmingprogramming

Total Page:16

File Type:pdf, Size:1020Kb

Perl Programmingprogramming PerlPerl ProgrammingProgramming Get Your Jobs Done! Computer Center, CS,NCTU SlidesSlides ContentsContents Introduction File Handle Data Structure and Sorting Flow Control CPAN • Scalar Complex Data Structure • List, Array and Hash Reference Reading • More on variables Appendix Regular Expression Subroutine Basic I/O 2 IntroductionIntroduction Perl Poetry: study, write, study, do review (each word) if time. close book. sleep? what's that? From a graduate student (in finals week) Computer Center, CS,NCTU IntroductionIntroduction (1)(1) PERL • Practical Extraction and Report Language • PEARL was used by another language • Created by Larry Wall and first released in 1987 Useful in • Text manipulation • Web development • Network programming • GUI development • System Prototyping • …anything to replace C, shell, or whatever you like 4 Computer Center, CS,NCTU IntroductionIntroduction (2)(2) Compiled and interpreted • Efficient Syntax Sugar • die unless $a == $b; Object oriented Modules • CPAN Perl6 • http://dev.perl.org/perl6/ • Pugs – http://www.pugscode.org/ ¾/usr/ports/lang/pugs/ • Parrot – http://www.parrotcode.org/ 5 Computer Center, CS,NCTU IntroductionIntroduction--HelloHello WorldWorld (1)(1) Hello World! #!/usr/bin/perl -w # My First Perl Program print “Hello”, “ world!\n”; #!/usr/bin/perl -w • Write down the location of perl interpreter # My First Perl Program • Comment, to the end of line print(“Hello”, ” world!\n”); • Built-in function for output to STDOUT C-like “;” termination 6 Computer Center, CS,NCTU IntroductionIntroduction--HelloHello WorldWorld (2)(2) hello.pl $name = <STDIN>; #!/usr/bin/perl chomp $name; print “What is your name? ”; chomp($name = <STDIN>); chomp is not pass by value print(“Hello, $name!\n”); Value interpolation into string scalar variable = <STDIN> • Read ONE line from standard input chomp • Remove trailing “\n” if exists Variables are global unless otherwise stated Run Perl Program % perl hello.pl (even no +x mode or perl indicator) % ./hello.pl (Need +x mode and perl indicator) 7 ScalarScalar DataData 1 + 1 == 10 Computer Center, CS,NCTU ScalarScalar DataData (1)(1)--TypesTypes Use prefix ‘$’ in the variable name of a scalar data • $scalar_value Numerical literals • Perl manipulates numbers as double-decision float point values • Float / Integer constants, such as: ¾1.25, -6.8, 6.23e23, 12, -8, 0377, 0xff, 0b00101100 Strings • Sequence of characters • Single-Quoted Strings (No interpolation) ¾‘$a\n is printed as is’, ‘don\’t’ • Double-Quoted Strings (With interpolation) ¾“$a will be replaced by its value.\n” ¾Escape characters – \n, \t, \r, \f, \b, \a 9 Computer Center, CS,NCTU ScalarScalar DataData (2)(2)--AssignmentsAssignments Operators for assignment • Ordinary assignment ¾$a = 17 ¾$b = “abc” • Short-cut assignment operators ¾Number: +=, -=, *=, /=, %=, **= ¾String: .=, x= – $str .= “.dat” Î$str = $str . “.dat” • Auto-increment and auto-decrement ¾$a++, ++$a, $a--, --$a 10 Computer Center, CS,NCTU ScalarScalar DataData (3)(3)--OperatorsOperators Operators for Numbers • Arithmetic ¾+, -, *, /, %, ** • Logical comparison ¾<, <=, ==, >=, >, != Operators for Strings • Concatenation “.” ¾“Hello” . “ ” . “world!” Î “Hello world!” • Repetition “x” ¾“abc” x 4 Î “abcabcabcabc” • Comparison ¾lt, le, eq, ge, gt, ne man perlop 11 Computer Center, CS,NCTU ScalarScalar DataData (4)(4)--ConversionConversion Implicit conversion depending on the context • Number wanted? ( 3 + “15” ) ¾Automatically convert to equivalent numeric value ¾Trailing nonnumeric are ignored – “123.45abc” Î 123.45 • String wanted? ¾Automatically convert to equivalent string ¾“x” . (4 * 5) Δx20” 12 Computer Center, CS,NCTU ScalarScalar DataData (5)(5)--StringString RelatedRelated FunctionsFunctions Find a sub-string • index(original-str, sub-str [,start position]) index(“a very long string”, “long”); # 7 index(“a very long string”, “lame”); # -1 index(“hello world”, “o”, 5); # 7 index(“hello world”, “o”, 8); # -1 Sub-string • Substring(string, start, length) substring(“a very long string”, 3, 2); # “er” substring(“a very long string”, -3, 3); # “ing” Formatting data • sprintf (C-like sprintf) man perlfunc: Functions for SCALARs or strings 13 Computer Center, CS,NCTU BranchesBranches--ifif // unlessunless True and False • 0, “0”, “”, or undef are false, others are true • “00”, “0.00” are true, but 00, 0.00 are false if-elsif-else if( $state == 0 ) { statement_1; statement_2; …; statement_n } elsif( $state == 1 ) { statements; } else { statements; } unless: short cut for if (! ….) unless( $weather eq “rain” ) { if( ! $weather eq “rain” ) { go-home; go-home; } } print “Good-bye” if $gameOver; 14 Keep_shopping() unless $money == 0; Computer Center, CS,NCTU Relational Operators if ($a == 1 && $b == 2) {…} if ($a == 1 || $b == 2) {…} if ($a == 1 && (! $b == 2)){…} if (not ($a == 1 and $b == 2) or ($c == 3)) {…} • not > and > or || has higher precedence than or, = • $a = $ARGV[0] || 40; # if $ARGV[0] is false, then $a = 40 • $a = $ARGV[0] or 40; # $a = $ARGV[0] open XX, “file” or die “open file failure!”; • or can be used for statement short-cut. man perlop for precedence 15 List,List, Array,Array, andand HashHash Computer Center, CS,NCTU ListList Ordered scalars, similar to linked-list List literal • Comma-separated values • Ex: ¾(1, 2, 3, 4, 5,) ¾($a, 8, 9, “hello”) ¾($a, $b, $c) = (1, 2, 3) ¾($a, $b) = ($b, $a) Î swap List constructor • Ex: ¾(1 .. 5)Î(1,2,3,4,5) ¾(a .. z) Î(a,b,c,d,e,…,z) ¾(1.3 .. 3.1) Î(1,2,3) ¾($a .. $b) Îdepend on values of $a and $b 17 Computer Center, CS,NCTU ArrayArray (1)(1) An indexed list, for random access Use prefix ‘@’ in the variable name of an array • @ary = (“a”, “b”, “c”) • @ary = qw(a b c) • @ary2 = @ary • @ary3 = (4.5, @ary2, 6.7) Î (4.5, “a”, “b”, “c”, 6.7) • $count = @ary3 Î 5, scalar context returns the length of an array • $ary3[-1] Î The last element of @ary3 • $ary3[$#ary3] Î $#ary3 is the last index • ($d, @ary4) = ($a, $b, $c) Î $d = $a, @ary4 = ($b, $c) • ($e, @ary5) = @ary4 Î $e = $b, @ary5 = ($c) 18 Computer Center, CS,NCTU ArrayArray (2)(2) Slice of array • Still an array, use prefix ‘@’ • Ex: ¾@a[3] = (2) ¾@a[0,1] = (3, 5) ¾@a[1,2] = @a[0,1] Beyond the index • Access will get “undef” ¾@ary = (3, 4, 5) ¾$a = $ary[8] • Assignment will extend the array ¾@ary = (3, 4, 5) ¾$ary[5] = “hi”Î @ary = (3, 4, 5, undef, undef, “hi”) 19 Computer Center, CS,NCTU ArrayArray (3)(3) Interpolation by inserting whitespace • @ary = (“a”, “bb”, “ccc”, 1, 2, 3) • $all = “Now for @ary here!” ¾ “Now for a bb ccc 1 2 3 here!” • $all = “Now for @ary[2,3] here!” ¾ “Now for ccc 1 here!” Array context for file input • @ary = <STDIN> ¾Read multiple lines from STDIN, each element contains one line, until the end of file. • print @ary Î Print the whole elements of @ary 20 Computer Center, CS,NCTU ArrayArray (4)(4) List or array operations Initially, @a = (1, 2); • Push, pop and shift ¾Use array as a stack – push @a, 3, 4, 5 Î @a = (1, 2, 3, 4, 5) – $top = pop @a Î $top = 5, @a = (1, 2, 3, 4) ¾As a queue – $a = shift @a Î $a = 1, @a = (2, 3, 4) • Reverse list ¾Reverse the order of the elements – @a = reverse @a Î @a = (4, 3, 2) • Sort list ¾Sort elements as strings in ascending ASCII order – @a = (1, 2, 4, 8, 16, 32, 64) – @a = sort @a Î (1, 16, 2, 32, 4, 64, 8) • Join list – @a=(1,2,3); $b = join ":", @a Î $b = “1:2:3” 21 Computer Center, CS,NCTU HashHash (1)(1) Collation of scalar data • An array whose elements are in <key, value> orders • Key is a string index, value is any scalar data • Use prefix “%” in the variable name of a hash • Ex: ¾ %age = (john => 20, mary => 30, ); Î same as (“john”, 20, “mary”, 30) ¾ $age{john} = 21; Î “john” => 21 ¾ %age = qw(john 20 mary 30) ¾ print “$age{john} \n” 22 Computer Center, CS,NCTU HashHash (2)(2) Hash operations %age = (john => 20, mary => 30, ); • keys ¾Yield a list of all current keys in hash – keys %age Î (“john”, “mary”) • values ¾Yield a list of all current values in hash – values %age Î (20, 30) • each ¾Return key-value pair until all elements have been accessed – each(%age) Î (“john”, 20) – each(%age) Î (“mary”, 30) • delete ¾Remove hash element – delete $age{“john”} Î %age = (mary => 30) 23 Computer Center, CS,NCTU FlowFlow ControlControl --whilewhile // untiluntil while and do-while $a = 10; while ( $a ) { print “$a\n”; --$a } $a = 10; print “$a\n” and --$a while $a ; do { statements-of-true-part; } while (condition); until and do-until • until (…) == while (! …) $a = 10; until ($a == 0) { print “$a\n”; --$a } do { statements-of-false-part; } until (expression); 24 Computer Center, CS,NCTU FlowFlow ControlControl --forfor // foreachforeach for @a = (1, 2, 3, 4, 5) for (my $i = 0; $i <= $#a; ++$i) { print “$a[$i]\n”; } foreach • For example: %age = (john => 20, mary => 30, ); foreach $name (keys %age) { print “$name is $age{$name} years old.\n”; } for (keys %age) { print “$_ is $age{$_} years old.\n”; } 25 Computer Center, CS,NCTU FlowFlow ControlControl --last,last, next,next, redoredo Loop-control • last ¾Like C “break” • next ¾Like C “continue” • redo ¾Jump to the beginning of the current loop block without revaluating the control expression ¾Ex: for($i=0;$i<10;$i++) { # infinite loop if($i == 1) { redo; } } 26 Computer Center, CS,NCTU FlowFlow ControlControl --LabeledLabeled BlockBlock Give name to block to archive “goto” purpose Use last, next, redo to goto any labeled block 1 1 1 1 1 2 Example: 1 1 3 1 2 1 LAB1: for($i=1;$i<=3;$i++) { 1 2 2 LAB2: for($j=1;$j<=3;$j++) { 1 2 3 LAB3: for($k=1;$k<=3;$k++)
Recommended publications
  • A Java Virtual Machine Extended to Run Parrot Bytecode
    A JAVA VIRTUAL MACHINE EXTENDED TO RUN PARROT BYTECODE A thesis submitted to the University of Manchester for the degree of Master of Science in the Faculty of Engineering and Physical Sciences 2006 By Martin Dahl School of Computer Science Contents Abstract 8 Declaration 9 Copyright 10 Acknowledgements 11 1 Introduction 12 1.1 Objectives and Motivation . 13 1.2 Related Work . 13 1.2.1 Parrot . 14 1.2.2 Pugs . 14 1.2.3 PearColator . 14 1.3 Organisation of the Thesis . 15 2 The Parrot Project 16 2.1 Perl 6 . 17 2.1.1 Design . 17 2.1.2 Perl 6 Internals . 18 2.1.3 Pugs . 19 2.1.4 Parrot Perl 6 Compiler . 19 2.2 Virtual Machine . 20 2.2.1 Design . 20 2.2.2 Architecture . 21 2.2.3 Registers . 22 2.2.4 Instruction Set . 23 2.2.5 Parrot Assembly Language and Intermediate Representation 24 2 2.3 Parrot Magic Cookies . 24 2.3.1 Core PMCs . 24 2.3.2 Other PMCs . 27 2.4 Compiler suite . 27 2.4.1 Perl 6 . 27 2.4.2 Other languages . 27 2.5 Summary . 28 3 Parrot Bytecode Format 30 3.1 Header . 31 3.2 Bytecode Format 1 . 33 3.2.1 Directory Segment . 34 3.2.2 Constant Table Segment . 35 3.2.3 Bytecode Segment . 38 3.2.4 Debug Segment . 38 3.2.5 Fixup Segment . 39 3.3 Summary . 40 4 Parakeet 41 4.1 Overview . 42 4.2 Jikes RVM . 43 4.3 PearColator .
    [Show full text]
  • Minimal Perl for UNIX and Linux People
    Minimal Perl For UNIX and Linux People BY TIM MAHER MANNING Greenwich (74° w. long.) For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. Cherokee Station PO Box 20386 Fax: (609) 877-8256 New York, NY 10021 email: [email protected] ©2007 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Manning Publications Co. Copyeditor: Tiffany Taylor 209 Bruce Park Avenue Typesetters: Denis Dalinnik, Dottie Marsico Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 1-932394-50-8 Printed in the United States of America 12345678910–VHG–1009080706 To Yeshe Dolma Sherpa, whose fortitude, endurance, and many sacrifices made this book possible. To my parents, Gloria Grady Washington and William N. Maher, who indulged my early interests in literature. To my limbic system, with gratitude for all the good times we’ve had together.
    [Show full text]
  • A Retrospective on Pugs ☺
    ☺ A retrospective on Pugs ☺ Ingo Blechschmidt <[email protected]> Augsburg.pm (April 13th, 2015) Pugs, an experimental Perl 6 platform: a retrospective 1 / 37 April 13th, 2015 Abstract. “Hi. Today I have started working on specifying and implementing Feath- erweight Perl 6 (FP6), a side-effect-free subset of Perl 6.” Audrey Tang used these words to unveil the Pugs project in February of 2005. Initially conceived as an imple- mentation of a small subset of Perl 6 in Haskell, the project quickly grew to contain a full-fledged compiler and interpreter for Perl 6 and aracted a large and diverse community. e talk will give a subjective survey of the history of Pugs. We will pay particular aention to the special manner with which Audrey led the project and what the phi- losophy “-Ofun” meant to the developers. We’ll also discuss which parts of Pugs were absorbed into other implementations of Perl 6 and which influence Pugs had on the Perl and Haskell communities. About me. I contributed to Pugs as a school student in 2005, at first by porting modules and writing tests, then gradually also by writing Haskell code and later by implement- ing a JavaScript backend. Audrey and the unique spirit in the Pugs community had a strong and lasting influence on me (exposing me to Haskell, category theory, and a beautiful way of tending communities); I look back on very exciting and fun days. Warning. e account is mostly from memory and not properly researched. Try not to trust it! Also note that the timeline covers only the year 2005 and that the code excerpts are edited for legibility, i.
    [Show full text]
  • Perl 6 Audrey Tang
    Deploying Perl 6 Audrey Tang 1 Perl 6 is here Today! 2 Perl 6 is here Today! (YAPC::NA 2005) 3 Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11 4 Parrot 0.4.5 •Released last June 19th •Unicode identifiers •Hierarchical namespace •New .NET CLR translator •Much faster compiler tools 5 Great for experimenting 6 But not for production 7 ...not this Christmas 8 9 CPAN is the language 10 Perl is just its syntax 11 Perl 5.000b3h (October 1994) 12 • use 5.000; • use strict; • require 'fastcwd.pl'; • require 'newgetopt.pl'; • require 'exceptions.pl'; • # ... • 13 Continuity++ 14 Pugs 6.2.2 (June 2005) 15 • use v6-pugs; • use perl5:DBI; • use perl5:Encode; • use perl5:Template; • # ... • 16 Still need to install Pugs 17 Perl 5.9.3 (Jan 2006) 18 • use v5.9.3; • use feature qw(switch say err ~~); • given (shift()) { • when ['‐h', '‐‐help'] { • say "Usage: $0"; • } • default { • $0 ~~ 'moose.exe' err die "Not Moose"; • } • } • 19 How to get Perl 6 into Production? 20 Production • Work with existing code • Must support Perl 5 and XS • No from‐scratch rewrites 21 Frontends? Tcl Python Scheme Parrot 22 Frontends? Tcl Python Scheme Perl 5 (Ponie) Parrot Perl 6 23 Backends! Pugs Java Haskell Perl 5 Script 24 Backends! JVM? YARV? Pugs CLR? PyPy? Java Haskell Perl 5 Script 25 Pugs on Perl 5 26 Perl 6 Runtime Implemented as Perl 5 Modules 27 Sane Perl 5 (not source filters) 28 Available On CPAN Today 29 Moose.pm ☯ 30 What is Moose? • Complete object model for Perl 5 • Based on the
    [Show full text]
  • Haskell Communities and Activities Report
    Haskell Communities and Activities Report http://www.haskell.org/communities/ Eighth Edition – May 13, 2005 Andres L¨oh (ed.) Perry Alexander Lloyd Allison Tiago Miguel Laureano Alves Krasimir Angelov Alistair Bayley J´er´emy Bobbio Bj¨orn Bringert Niklas Broberg Paul Callaghan Mark Carroll Manuel Chakravarty Olaf Chitil Koen Claessen Catarina Coquand Duncan Coutts Philippa Cowderoy Alain Cr´emieux Iavor Diatchki Atze Dijkstra Shae Erisson Sander Evers Markus Forsberg Simon Foster Leif Frenzel Andr´eFurtado John Goerzen Murray Gross Walter Gussmann Jurriaan Hage Sven Moritz Hallberg Thomas Hallgren Keith Hanna Bastiaan Heeren Anders H¨ockersten John Hughes Graham Hutton Patrik Jansson Johan Jeuring Paul Johnson Isaac Jones Oleg Kiselyov Graham Klyne Daan Leijen Huiqing Li Andres L¨oh Rita Loogen Salvador Lucas Christoph Luth¨ Ketil Z. Malde Christian Maeder Simon Marlow Conor McBride John Meacham Serge Mechveliani Neil Mitchell William Garret Mitchener Andy Moran Matthew Naylor Rickard Nilsson Jan Henry Nystr¨om Sven Panne Ross Paterson Jens Petersen John Peterson Simon Peyton-Jones Jorge Sousa Pinto Bernie Pope Claus Reinke Frank Rosemeier David Roundy George Russell Chris Ryder David Sabel Uwe Schmidt Martijn Schrage Peter Simons Anthony Sloane Dominic Steinitz Donald Bruce Stewart Martin Sulzmann Autrijus Tang Henning Thielemann Peter Thiemann Simon Thompson Phil Trinder Arjan van IJzendoorn Tuomo Valkonen Eelco Visser Joost Visser Malcolm Wallace Ashley Yakeley Jory van Zessen Bulat Ziganshin Preface You are reading the 8th edition of the Haskell Communities and Activities Report (HCAR). These are interesting times to be a Haskell enthusiast. Everyone seems to be talking about darcs (→ 6.3) and Pugs (→ 6.1) these days, and it is nice to see Haskell being mentioned in places where it usually was not.
    [Show full text]
  • Pugs Perl 6 for Real Autrijus Tang CUFP 2005, Tallinn Perl Is Ergonomic
    Pugs Perl 6 For Real http://pugscode.org/ Autrijus Tang CUFP 2005, Tallinn Perl is ergonomic P is for Practical Manipulexity & Whipuptitude Manipulexity C Perl sed awk shell (circa. 1990) Whipuptitude Abstraction → Sexy Closures Bless / Tie BEGIN block Shorthand → Natural Regex Contexts $_ as Topic Stepping sideways CPAN is versatile No coding = Best coding 10+ years 2500+ authors 8000+ modules Smoke Testing Issue Tracking Rating & Discussion Package Management Vocabulary > Syntax Addictive Super glue Jenga Syndrome Perl 6 is powerful RFC Parrot Apocalypses Lazy Evaluation Rebindable Grammar Dependent Constrained Soft Typing Traits Metamodel MMD on Type & Value Syntactic Aspartame without Bloat use perl5:DBI; use jsan:DOM; …but it stayed Imaginary for 5 years Perl6::Rules P6C/PIR PGE/PAST Deadlocked: Insufficient Manipulexity Haskell is fantastic SVK steals from the best: Darcs “The Dream that stuff are made of” “An alien language” $work in C Terabytes of AFP Evil Binary Format Old AIX machine Parse::AFP Prototype in perl5 Leaks horribly Hard to refactor OpenAFP.hs 30 days 3000 lines Highly efficient touchForeignPtr unsafeInterleaveIO WriterT ReaderT IO 3-arg class with Fundeps DSL, TH, Generics (Kudos to #haskell) Feb 1st TaPL arrived as an exercise… Pugs is expansive Feb 6th Primitive Interpreter (1|2)+(3|4)→(4|5|6) Parsec.Expr Feb 16th Imperative runtime say “Hello, world” ContT ReaderT Feb 23rd Test.pm runs is(1+1, 2, ‘add’) 10,000 tests today Mar 19th PCRE Regex s:p5:g/x/Y/; hsregex Apr 26th BEGIN blocks use fp; unsafePerformIO May
    [Show full text]
  • Index Images Download 2006 News Crack Serial Warez Full 12 Contact
    index images download 2006 news crack serial warez full 12 contact about search spacer privacy 11 logo blog new 10 cgi-bin faq rss home img default 2005 products sitemap archives 1 09 links 01 08 06 2 07 login articles support 05 keygen article 04 03 help events archive 02 register en forum software downloads 3 security 13 category 4 content 14 main 15 press media templates services icons resources info profile 16 2004 18 docs contactus files features html 20 21 5 22 page 6 misc 19 partners 24 terms 2007 23 17 i 27 top 26 9 legal 30 banners xml 29 28 7 tools projects 25 0 user feed themes linux forums jobs business 8 video email books banner reviews view graphics research feedback pdf print ads modules 2003 company blank pub games copyright common site comments people aboutus product sports logos buttons english story image uploads 31 subscribe blogs atom gallery newsletter stats careers music pages publications technology calendar stories photos papers community data history arrow submit www s web library wiki header education go internet b in advertise spam a nav mail users Images members topics disclaimer store clear feeds c awards 2002 Default general pics dir signup solutions map News public doc de weblog index2 shop contacts fr homepage travel button pixel list viewtopic documents overview tips adclick contact_us movies wp-content catalog us p staff hardware wireless global screenshots apps online version directory mobile other advertising tech welcome admin t policy faqs link 2001 training releases space member static join health
    [Show full text]
  • Learning Perl. 5Th Edition [PDF]
    Learning Perl ,perlroadmap.24755 Page ii Tuesday, June 17, 2008 8:15 AM Other Perl resources from O’Reilly Related titles Advanced Perl Programming Perl Debugger Pocket Intermediate Perl Reference Mastering Perl Perl in a Nutshell Perl 6 and Parrot Essentials Perl Testing: A Developer’s Perl Best Practices Notebook Perl Cookbook Practical mod-perl Perl Books perl.oreilly.com is a complete catalog of O’Reilly’s books on Perl Resource Center and related technologies, including sample chapters and code examples. Perl.com is the central web site for the Perl community. It is the perfect starting place for finding out everything there is to know about Perl. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in document- ing the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit conferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online refer- ence library for programmers and ITprofessionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or sim- ply flip to the page you need. Try it today with a free trial. main.title Page iii Monday, May 19, 2008 11:21 AM FIFTH EDITION LearningTomcat Perl™ The Definitive Guide Randal L. Schwartz,Jason Tom Brittain Phoenix, and and Ian brian F. Darwin d foy Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Learning Perl, Fifth Edition by Randal L.
    [Show full text]
  • Pragmaticperl-Interviews-A4.Pdf
    Pragmatic Perl Interviews pragmaticperl.com 2013—2015 Editor and interviewer: Viacheslav Tykhanovskyi Covers: Marko Ivanyk Revision: 2018-03-02 11:22 © Pragmatic Perl Contents 1 Preface .......................................... 1 2 Alexis Sukrieh (April 2013) ............................... 2 3 Sawyer X (May 2013) .................................. 10 4 Stevan Little (September 2013) ............................. 17 5 chromatic (October 2013) ................................ 22 6 Marc Lehmann (November 2013) ............................ 29 7 Tokuhiro Matsuno (January 2014) ........................... 46 8 Randal Schwartz (February 2014) ........................... 53 9 Christian Walde (May 2014) .............................. 56 10 Florian Ragwitz (rafl) (June 2014) ........................... 62 11 Curtis “Ovid” Poe (September 2014) .......................... 70 12 Leon Timmermans (October 2014) ........................... 77 13 Olaf Alders (December 2014) .............................. 81 14 Ricardo Signes (January 2015) ............................. 87 15 Neil Bowers (February 2015) .............................. 94 16 Renée Bäcker (June 2015) ................................ 102 17 David Golden (July 2015) ................................ 109 18 Philippe Bruhat (Book) (August 2015) . 115 19 Author .......................................... 123 i Preface 1 Preface Hello there! You have downloaded a compilation of interviews done with Perl pro- grammers in Pragmatic Perl journal from 2013 to 2015. Since the journal itself is in Russian
    [Show full text]
  • Perl 6 / Parrot
    Perl 6 / Parrot April 2009 Friday, April 3, 2009 Pieces and Parts Perl 6 Rakudo Pugs Parrot Machine April 2009 Friday, April 3, 2009 Parrot is a virtual machine designed to efficiently compile and execute bytecode for dynamic languages. Parrot is designed with the needs of dynamically typed languages (such as Perl and Python) in mind, and should be able to run programs written in these languages more efficiently than VMs developed with static languages in mind (JVM, .NET). Parrot is also designed to provide interoperability between languages that compile to it. In theory, you will be able to write a class in Perl, subclass it in Python and then instantiate and use that subclass in a Tcl program. April 2009 Friday, April 3, 2009 Parrot Submitted by allison on Tue, 03/17/2009 - 21:54. ... On behalf of the Parrot team, I'm proud to announce Parrot 1.0.0 "Haru Tatsu." April 2009 Friday, April 3, 2009 Four instruction formats ✤ PIR (Parrot Intermediate Representation) ✤ PASM (Parrot Assembly) ✤ PAST (Parrot Abstract Syntax Tree) enables Parrot to accept an abstract syntax tree style input - useful for those writing compilers. ✤ PBC (Parrot Bytecode) The above forms are automatically converted inside Parrot to PBC. Like machine code but understood by the Parrot interpreter. It is not intended to be human-readable or human- writable, but unlike the other forms execution can start immediately, without the need for an assembly phase. PBC is platform independent. April 2009 http://docs.parrot.org/parrot/latest/html/ Friday, April 3, 2009 Parrot PIR Parrot Intermediate Representation is designed to be written by people and generated by compilers.
    [Show full text]
  • Workshop for Commercial Users of Functional Programming, Tallinn, Estonia, September 2005
    Workshop for Commercial Users of Functional Programming, Tallinn, Estonia, September 2005. Functional programming as a means not an end. Many of the slides from this meeting are available from the CUFP website: http://www.galois.com/cufp/ Notes by Simon Thompson, Computing Laboratory, University of Kent, Canterbury, CT2 7NF, UK. [email protected] Draft 2, 16 October 2005 Introduction The first one-day workshop for Commercial Users of Functional Programming took place in September 2004 in Snowbird, Utah, as a part of ICFP 2004, and was reported in the December 2004 issue of SIGPLAN Notices by Andy Moran. The second meeting, again co-located with ICFP, was held on 24 September in Tallinn, Estonia. Attendance was a healthy 40 plus, doubling last year's numbers. Eight speakers shared their experiences of using functional languages 'in anger' and two wide-ranging discussions completed the day's programme. The goal of CUFP is to build a community for users of functional programming languages and technology, be they using functional languages in their professional lives, in an open source project (other than implementation of functional languages), as a hobby, or any combination thereof. In short: anyone who uses functional programming as a means, but not an end. In that sense the 'commercial' is a misnomer, and may well be dropped by future workshops. The emphasis of the workshop is on use rather than research or development, and as such, the focus of the meeting is quite diferent from the main tracks. Instead of the emphasis on yet another language enhancement or extension, the focus is the complete package of language, libraries, implementations, tools and training, and how these together support or hinder the widespread adoption and use of functional languages in large-scale projects, be they commercial, open source, or indeed in universities.
    [Show full text]
  • The Parrot VM (40’)
    The Parrot VM (40’) Its goals and challenges for dynamic languages François Perrad [email protected] About Me Parrot-porter since Oct 2005 In the TOP 10 of committers Releaser Manager of Parrot 1.1.0 Packager for Windows (with mingw) http://sourceforge.net/projects/parrotwin32/ ~1 daily build on Smolder Mostly a HLL implementor Lua WMLScript (bytecode translator) Markdown … About Parrot VM a Virtual Machine started in 2001 … targets dynamic languages multi paradigm : functional, OO, … Register based (not stack based) Continuation Passing Style (CPS) allows interoperability between HLL (High Level Language) reuse components a great environment for HLL implementor Visible side effects CLR/DLR JSR 292 About commodity commodity is some good for which there is demand, but which is supplied without qualitative differentiation across a market An example generic pharmaceuticals the interest for customers is lower prices About commoditization commoditization is the process by which goods that have economic value and are distinguishable in terms of attributes (uniqueness or brand) end up becoming simple commodities in the eyes of the market or consumers. An example : Eclipse IDE IBM gives/opens its codebase the IDE market disappears competitors die or survive in niche segment a new market : plugins for Eclipse Who is best placed in this market ? Who controls the Eclipse roadmap ? A stack of commodities My Web App A stack of commodities My Web App Hardware A stack of commodities My Web App Operating System
    [Show full text]