Programming Perl

2y ago
24 Views
2 Downloads
1.57 MB
252 Pages
Last View : 16d ago
Last Download : 2m ago
Upload by : Gia Hauser
Transcription

Programming Perl#!/usr/bin/perl wuse strict; ’eval("seek\040DATA,0,0;");foreach(1.2){ DATA ;}my@camel1hump;my camel;my Camel ;while( DATA ){ sprintf("% 69s", );my@dromedary1 split(//);if(defined( DATA )){@camel1hump split(//);}while(@dromedary1){my camel1hump 0;my CAMEL 3;if(defined( shift(@dromedary1))&&/\S/){ camel1hump 1 CAMEL;} CAMEL ;if(defined( shift(@dromedary1))&&/\S/){ camel1hump 1 CAMEL;} CAMEL ;if(defined( shift(@camel1hump))&&/\S/){ camel1hump 1 CAMEL;} CAMEL ;if(defined( shift(@camel1hump))&&/\S/){ camel1hump 1 CAMEL;;} camel. (split(//,"\040.m‘{/J\047\134}L 7FX"))[ camel1hump];} camel. "\n";}@camel1hump split(/\n/, camel);foreach(@camel1hump){chomp; Camel 5678/JL7F\175\173\047‘/; reverse;print" \040 Camel\n";}foreach(@camel1hump){chomp; Camel 175\173\047‘/; reverse;print"\040 Camel\n";}#japh );undef /; DATA ;s \s* g;();;s; .* ;;;map{eval"print\" \"";}/.{4}/g; DATA\124\150\145\040\165\163\145\040\157\1 46\040\1 41\040\143\141 \155\145\1 54\040\151\155\ 141\147\145\0 40\151\156 \040\141\163\16 3\157\143\151\141\16 4\151\157\156\040\167 \146\040\117\047\122\145\151\154\1 44\040\167\151\164\1 Kirrily RobertPaul FenwickJacinta Richardson

Programming Perlby Kirrily Robert, Paul Fenwick, and Jacinta RichardsonCopyright 1999-2000 Netizen Pty LtdCopyright 2000 Kirrily RobertCopyright 2001 Obsidian Consulting Group Pty LtdCopyright 2001-2011 Paul Fenwick (pjf@perltraining.com.au)Copyright 2001-2011 Jacinta Richardson (jarich@perltraining.com.au)Copyright 2001-2011 Perl Training AustraliaOpen Publications License 1.0Cover artwork Copyright (c) 2000 by Stephen B. Jenkins. Used with permission.The use of a camel image with the topic of Perl is a trademark of O’Reilly & Associates, Inc. Used with permission.This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latestversion is presently available at http://www.opencontent.org/openpub/).Distribution of this work or derivative of this work in any standard (paper) book form is prohibited unless prior permission is obtained fromthe copyright holder.This document is a revised and edited copy of the Introduction to Perl and Intermediate Perl training notes originally created by KirrilyRobert and Netizen Pty Ltd. These revisions were made by Paul Fenwick and Jacinta Richardson.Copies of the original training manuals can be found at http://sourceforge.net/projects/sporkThis training manual is maintained by Perl Training Australia, and can be found at http://www.perltraining.com.au/notes.htmlThis is version 1.39 of Perl Training Australia’s "Programming Perl" training manual.

Table of Contents1. About Perl Training Australia . 1Training . 1Consulting . 1Contact us. 12. Introduction. 3Credits . 3Course outline . 3Day 1 . 3Day 2 . 3Day 3 . 3Day 4 . 3Day 5 . 4Assumed knowledge . 4Platform and version details. 4The course notes. 4Other materials . 53. What is Perl . 7In this chapter. . 7License . 7Perl’s name and history . 7Typical uses of Perl . 7Text processing . 7System administration tasks . 7CGI and web programming. 8Database interaction . 8Other Internet programming. 8Less typical uses of Perl . 8What is Perl like? . 8The Perl Philosophy . 9There’s more than one way to do it . 9A correct Perl program. . 9Three virtues of a programmer. 9Laziness. 9Impatience. 9Hubris. 10Three more virtues. 10Share and enjoy! . 10Parts of Perl . 10The Perl interpreter. 10Manuals/Documentation. 11Perl Modules. 11Chapter summary . 114. A brief guide to perldoc. 13Using perldoc . 13Other ways to access perldoc . 13Exercise . 13Language features and tutorials . 13Looking up functions . 14Perl Training Australia (http://perltraining.com.au/)iii

Searching the FAQs. 14Looking up modules. 145. Creating and running a Perl program. 17In this chapter. . 17Logging into your account . 17Our first Perl program . 17Running a Perl program from the command line. 17Executing code . 18The "shebang" line for Unix. 18The "shebang" line for non-Unixes . 19Command line options and warnings. 19Lexical warnings. 19Comments . 20Block comments . 20END . 20Chapter summary . 206. Perl variables. 23In this chapter. . 23What is a variable? . 23Variable names . 23Strictures . 23Using the strict pragma (predeclaring variables). 24Exercise. 24Starting your Perl program. 25Specifying your version. 25Scalars . 25Double and single quotes . 27Exercise . 27Special characters . 27Advanced variable interpolation. 28say (Perl 5.10.0 ) . 28Exercises. 29Arrays. 29Initialising an array. 29Reading and changing array values . 29Array slices . 30Array interpolation . 30Counting backwards . 31Finding out the size of an array . 31Using qw// to populate arrays. 31Printing out the values in an array . 32A quick look at context. 32What’s the difference between a list and an array? . 33Exercises. 33Advanced exercises . 34Hashes . 34Initialising a hash. 34Reading hash values . 35Adding new hash elements . 35Changing hash values . 35Deleting hash values. 36ivPerl Training Australia (http://perltraining.com.au/)

Finding out the size of a hash . 36Other things about hashes. 36Exercises. 37Special variables. 37The special variable . 37@ARGV - a special array. 38%ENV - a special hash . 39Exercises. 39Programming practices . 39Perltidy . 39Perl Critic. 40Chapter summary . 407. Operators and functions. 43In this chapter. . 43What are operators and functions?. 43Operators. 43Arithmetic operators. 43String operators . 44Exercises. 45Advanced exercise . 45Other operators . 45Functions. 45Types of arguments. 46Return values . 47More about context . 47Some easy functions. 48String manipulation . 48Finding the length of a string .

This document is a revised and edited copy of the Introduction to Perl and Intermediate Perl training notes originally created by Kirrily Robert and Netizen Pty Ltd. These revisions

Related Documents:

Why Perl? Perl is built around regular expressions -REs are good for string processing -Therefore Perl is a good scripting language -Perl is especially popular for CGI scripts Perl makes full use of the power of UNIX Short Perl programs can be very short -"Perl is designed to make the easy jobs easy,

Perl can be embedded into web servers to speed up processing by as much as 2000%. Perl's mod_perl allows the Apache web server to embed a Perl interpreter. Perl's DBI package makes web-database integration easy. Perl is Interpreted Perl is an interpreted language, which means that your code can be run as is, without a

Other Perl resources from O’Reilly Related titles Learning Perl Programming Perl Advanced Perl Programming Perl Best Practices Perl Testing: A Developer’s . Intermedi

Run Perl Script Option 3: Create a Perl script my_script.pl: Run my_script.pl by calling perl: 8/31/2017 Introduction to Perl Basics I 10 print Hello World!\n; perl ./my_script.pl Option 4: For a small script with several lines, you can run it directly on the command line: perl -e print Hello World!\n;

Perl's creator, Larry Wall, announced it the next day in his State of the Onion address. Most notably, he said "Perl 6 is going to be designed by the community." Everyone thought that Perl 6 would be the version after the just-released Perl v5.6. That didn't happen, but that's why "Perl" was in the name "Perl 6."

tutorial Sorry about that but I have to keep my tutorial's example scripts short and to the point Finally, this is a tutorial for Perl/Tk only I will not be teaching perl here So if you know perl, continue But if you are a beginner to perl, I would recommend that you read my perl tutorial

Run Perl Script Option 3: Create a Perl script my_script.pl: Run my_script.pl by calling perl: 8/31/2017 Introduction to Perl Basics I 10 print Hello World!\n; perl ./my_script.pl Option 4: For a small script with several lines, you can run it directly on the command line: perl -e print Hello World!\n;

Introduction to Perl Pinkhas Nisanov. Perl culture Perl - Practical Extraction and Report Language Perl 1.0 released December 18, 1987 by Larry Wall. Perl culture Perl Poems BEFOREHAND: close door, each window & exit; wait until time. open spellbook, study, read (scan, select, tell us);