Learning Perl MAKING EASY THINGS EASY and HARD THINGS POSSIBLE

Total Page:16

File Type:pdf, Size:1020Kb

Learning Perl MAKING EASY THINGS EASY and HARD THINGS POSSIBLE 7th Edition Learning Perl MAKING EASY THINGS EASY AND HARD THINGS POSSIBLE Randal L. Schwartz, brian d foy & Tom Phoenix SEVENTH EDITION Learning Perl Making Easy Things Easy and Hard Things Possible Randal L. Schwartz, brian d foy, and Tom Phoenix Beijing Boston Farnham Sebastopol Tokyo Learning Perl by Randal L. Schwartz, brian d foy, and Tom Phoenix Copyright © 2017 Randal L. Schwartz, brian foy, and Tom Phoenix. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐ tutional sales department: 800-998-9938 or [email protected]. Editor: Heather Scherer Indexer: Lucie Haskins Production Editor: Melanie Yarbrough Interior Designer: David Futato Copyeditor: Jasmine Kwityn Cover Designer: Karen Montgomery Proofreader: Sonia Saruba Illustrator: Rebecca Demarest October 2016: Seventh Edition Revision History for the Seventh Edition 2016-10-05: First Release 2018-03-02: Second Release See http://oreilly.com/catalog/errata.csp?isbn=9781491954324 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Learning Perl, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-491-95432-4 [LSI] Table of Contents Preface. xi 1. Introduction. 1 Questions and Answers 1 Is This the Right Book for You? 1 What About the Exercises and Their Answers? 2 What If I’m a Perl Course Instructor? 3 What Does “Perl” Stand For? 4 Why Did Larry Create Perl? 4 Why Didn’t Larry Just Use Some Other Language? 4 Is Perl Easy or Hard? 5 How Did Perl Get to Be So Popular? 7 What’s Happening with Perl Now? 7 What’s Perl Really Good For? 7 What Is Perl Not Good For? 8 How Can I Get Perl? 8 What Is CPAN? 9 Is There Any Kind of Support? 9 What If I Find a Bug in Perl? 10 How Do I Make a Perl Program? 10 A Simple Program 11 What’s Inside That Program? 13 How Do I Compile My Perl Program? 15 A Whirlwind Tour of Perl 16 Exercises 17 2. Scalar Data. 19 Numbers 19 iii All Numbers Have the Same Format Internally 20 Integer Literals 20 Nondecimal Integer Literals 21 Floating-Point Literals 21 Numeric Operators 22 Strings 23 Single-Quoted String Literals 24 Double-Quoted String Literals 24 String Operators 25 Automatic Conversion Between Numbers and Strings 26 Perl’s Built-In Warnings 27 Interpreting Nondecimal Numerals 28 Scalar Variables 29 Choosing Good Variable Names 30 Scalar Assignment 31 Compound Assignment Operators 31 Output with print 32 Interpolation of Scalar Variables into Strings 32 Creating Characters by Code Point 33 Operator Precedence and Associativity 34 Comparison Operators 36 The if Control Structure 37 Boolean Values 37 Getting User Input 38 The chomp Operator 39 The while Control Structure 40 The undef Value 40 The defined Function 41 Exercises 41 3. Lists and Arrays. 43 Accessing Elements of an Array 44 Special Array Indices 45 List Literals 45 The qw Shortcut 46 List Assignment 47 The pop and push Operators 49 The shift and unshift Operators 49 The splice Operator 50 Interpolating Arrays into Strings 51 The foreach Control Structure 52 Perl’s Favorite Default: $_ 53 iv | Table of Contents The reverse Operator 53 The sort Operator 54 The each Operator 54 Scalar and List Context 55 Using List-Producing Expressions in Scalar Context 56 Using Scalar-Producing Expressions in List Context 58 Forcing Scalar Context 58 <STDIN> in List Context 58 Exercises 59 4. Subroutines. 61 Defining a Subroutine 61 Invoking a Subroutine 62 Return Values 62 Arguments 64 Private Variables in Subroutines 66 Variable-Length Parameter Lists 67 A Better &max Routine 67 Empty Parameter Lists 68 Notes on Lexical (my) Variables 69 The use strict Pragma 70 The return Operator 71 Omitting the Ampersand 72 Nonscalar Return Values 74 Persistent, Private Variables 74 Subroutine Signatures 76 Exercises 78 5. Input and Output. 81 Input from Standard Input 81 Input from the Diamond Operator 83 The Double Diamond 85 The Invocation Arguments 85 Output to Standard Output 86 Formatted Output with printf 89 Arrays and printf 91 Filehandles 91 Opening a Filehandle 93 Binmoding Filehandles 96 Bad Filehandles 96 Closing a Filehandle 97 Fatal Errors with die 97 Table of Contents | v Warning Messages with warn 99 Automatically die-ing 99 Using Filehandles 100 Changing the Default Output Filehandle 100 Reopening a Standard Filehandle 101 Output with say 102 Filehandles in a Scalar 102 Exercises 104 6. Hashes. 107 What Is a Hash? 107 Why Use a Hash? 109 Hash Element Access 110 The Hash as a Whole 111 Hash Assignment 112 The Big Arrow 113 Hash Functions 114 The keys and values Functions 114 The each Function 115 Typical Use of a Hash 116 The exists Function 117 The delete Function 117 Hash Element Interpolation 118 The %ENV hash 118 Exercises 119 7. Regular Expressions. 121 Sequences 121 Practice Some Patterns 123 The Wildcard 125 Quantifiers 126 Grouping in Patterns 130 Alternation 133 Character Classes 134 Character Class Shortcuts 135 Negating the Shortcuts 137 Unicode Properties 137 Anchors 138 Word Anchors 139 Exercises 141 vi | Table of Contents 8. Matching with Regular Expressions. 143 Matches with m// 143 Match Modifiers 144 Case-Insensitive Matching with /i 144 Matching Any Character with /s 144 Adding Whitespace with /x 145 Combining Option Modifiers 146 Choosing a Character Interpretation 146 Beginning and End-of-Line Anchors 148 Other Options 149 The Binding Operator =~ 149 The Match Variables 150 The Persistence of Captures 151 Noncapturing Parentheses 152 Named Captures 153 The Automatic Match Variables 155 Precedence 157 Examples of Precedence 158 And There’s More 158 A Pattern Test Program 159 Exercises 159 9. Processing Text with Regular Expressions. 161 Substitutions with s/// 161 Global Replacements with /g 162 Different Delimiters 163 Substitution Modifiers 163 The Binding Operator 163 Nondestructive Substitutions 163 Case Shifting 164 Metaquoting 166 The split Operator 166 The join Function 168 m// in List Context 168 More Powerful Regular Expressions 169 Nongreedy Quantifiers 169 Fancier Word Boundaries 170 Matching Multiple-Line Text 172 Updating Many Files 172 In-Place Editing from the Command Line 174 Exercises 176 Table of Contents | vii 10. More Control Structures. 177 The unless Control Structure 177 The else Clause with unless 178 The until Control Structure 178 Statement Modifiers 179 The Naked Block Control Structure 180 The elsif Clause 181 Autoincrement and Autodecrement 182 The Value of Autoincrement 182 The for Control Structure 183 The Secret Connection Between foreach and for 185 Loop Controls 186 The last Operator 186 The next Operator 187 The redo Operator 188 Labeled Blocks 189 The Conditional Operator 190 Logical Operators 191 The Value of a Short-Circuit Operator 192 The defined-or Operator 193 Control Structures Using Partial-Evaluation Operators 194 Exercises 196 11. Perl Modules. 197 Finding Modules 197 Installing Modules 198 Using Your Own Directories 199 Using Simple Modules 201 The File::Basename Module 202 Using Only Some Functions from a Module 203 The File::Spec Module 204 Path::Class 205 Databases and DBI 205 Dates and Times 206 Exercises 207 12. File Tests. 209 File Test Operators 209 Testing Several Attributes of the Same File 213 Stacked File Test Operators 214 The stat and lstat Functions 216 The localtime Function 217 viii | Table of Contents Bitwise Operators 218 Using Bitstrings 219 Exercises 222 13. Directory Operations. 223 The Current Working Directory 223 Changing the Directory 224 Globbing 225 An Alternate Syntax for Globbing 227 Directory Handles 228 Manipulating Files and Directories 229 Removing Files 230 Renaming Files 231 Links and Files 232 Making and Removing Directories 237 Modifying Permissions 239 Changing Ownership 239 Changing Timestamps 240 Exercises 240 14. Strings and Sorting. 243 Finding a Substring with index 243 Manipulating a Substring with substr 245 Formatting Data with sprintf 246 Using sprintf with “Money Numbers” 247 Advanced Sorting 248 Sorting a Hash by Value 252 Sorting by Multiple Keys 253 Exercises 254 15. Process Management. 255 The system Function 255 Avoiding the Shell 258 The Environment Variables 260 The exec Function 261 Using Backquotes to Capture Output 262 Using Backquotes in a List Context 264 External Processes with IPC::System::Simple 266 Processes as Filehandles 267 Getting Down and Dirty with Fork 269 Sending and Receiving Signals 270 Exercises 273 Table of Contents | ix 16. Some Advanced Perl Techniques. 275 Slices 275 Array Slice 277 Hash Slice 279 Key-Value Slices 280 Trapping Errors 281 Using eval 281 More Advanced Error Handling 285 Picking Items from a List with grep 287 Transforming Items from a List with map 288 Fancier List Utilities 289 Exercises 291 A. Exercise Answers. 293 B. Beyond the Llama. 329 C. A Unicode Primer. 339 D.
Recommended publications
  • Installing Visual Flagship for MS-Windows
    First Steps with Visual FlagShip 8 for MS-Windows 1. Requirements This instruction applies for FlagShip port using Microsoft Visual Studio 2017 (any edition, also the free Community), or the Visual Studio 2015. The minimal requirements are: • Microsoft Windows 32bit or 64bit operating system like Windows-10 • 2 GB RAM (more is recommended for performance) • 300 MB free hard disk space • Installed Microsoft MS-Visual Studio 2017 or 2015 (see step 2). It is re- quired for compiling .c sources and to link with corresponding FlagShip library. This FlagShip version will create 32bit or 64bit objects and native executables (.exe files) applicable for MS-Windows 10 and newer. 2. Install Microsoft Visual Studio 2017 or 2015 If not available yet, download and install Microsoft Visual Studio, see this link for details FlagShip will use only the C/C++ (MS-VC) compiler and linker from Visual Studio 2017 (or 2015) to create 64-bit and/or 32- bit objects and executables from your sources. Optionally, check the availability and the correct version of MS-VC compiler in CMD window (StartRuncmd) by invoking C:\> cd "C:\Program Files (x86)\Microsoft Visual Studio\ 2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64" C:\> CL.exe should display: Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64 Don’t worry if you can invoke CL.EXE only directly with the path, FlagShip’s Setup will set the proper path for you. Page 1 3. Download FlagShip In your preferred Web-Browser, open http://www.fship.com/windows.html and download the Visual FlagShip setup media using MS-VisualStudio and save it to any folder of your choice.
    [Show full text]
  • Open Source Ethos Guiding Beliefs Or Ideals That Characterize a Community
    Open Source Ethos guiding beliefs or ideals that characterize a community Patrick Masson Open Source Initiative [email protected] What is the mission of the conference? …bring smart and creative people together; …inspire and motivate them to create new and amazing things; …with an intimate group of like minded individuals. What is the mission of the conference? …bring smart and creative people together; …inspire and motivate them to create new and amazing things; …with an intimate group of like minded individuals. This is the open source ethos – guiding beliefs, ideals of a community It's a great time to be working with open source 1.5 Million Projects 78% of companies run on open source 64% of companies participate It's a great time to be working with open source 88% expect contributions to grow 66% consider before proprietary <3% Don't use OSS 2015 Future of Open Source Survey Black Duck, Northbridge It's a great time to be working with open source It's a great time to be working with open source It's a great time to be working with open source It's a great time to be working with open source Open-course/Open-source Marc Wathieu CC-BY-NC-SA https://www.flickr.com/photos/marcwathieu/2412755417/ _____ College first Massive Open source Online Course (MOOC) Are you seeing other examples of this Mini-MOOC trend (free, I began but did not finish my first The Gates grantees aren’t the only ones open source courses by a MOOC (Massive Open-Source, startup or organization)? Online Course).
    [Show full text]
  • Katalog Elektronskih Knjiga
    KATALOG ELEKTRONSKIH KNJIGA Br Autor Naziv Godina ISBN Str. Porijeklo izdavanja 1 Peter Kent Pay Per Click Search 2006 0-471-74594-3 130 Kupovina Engine Marketing for Dummies 2 Terry Large Access 1 2007 Internet Freeware 3 Kevin Smith Excel Lassons & Tutorials 2004 Internet Freeware 4 Terry Michael Photografy Tutorials 2006 Internet Freeware Janine Peterson Phil Pivnick 5 Jake Ludington Converting Vinyl LPs 2003 Internet Freeware to CD 6 Allen Wyatt Cleaning Windows XP 2004 0-7645-7311-X Poklon for Dummies 7 Peter Kent Sarch Engine Optimization 2006 0-4717-5441-2 Kupovina for Dummies 8 Terry Large Access 2 2007 Internet Freeware 9 Dirk Dupon How to write, create, 2005 Internet Freeware promote and sell E-books on the Internet 10 Chayden Bates eBook Marketing 2000 Internet Freeware Explained 11 Kevin Sinclair How To Choose A 1999 Internet Freeware Homebased Bussines 12 Bob McElwain 101 Newbie-Frendly Tips 2001 Internet Freeware 13 Windows Basics 2004 Poklon 14 Michael Abrash Zen of Graphic 2005 Poklon Programming, 2. izdanje 15 13 Hot Internet 2000 Internet Freeware Moneymaking Methods 16 K. Williams The Complete HTML 1998 Poklon Teacher 17 C. Darwin On the Origin of Species Internet Freeware 2/175 Br Autor Naziv Godina ISBN Str. Porijeklo izdavanja 18 C. Darwin The Variation of Animals Internet Freeware 19 Bruce Eckel Thinking in C++, Vol 1 2000 Internet Freeware 20 Bruce Eckel Thinking in C++, Vol 2 2000 Internet Freeware 21 James Parton Captains of Industry 1890 399 Internet Freeware 22 Bruno R. Preiss Data Structures and 1998 Internet
    [Show full text]
  • Introduction for Position ID Senior C++ Developer 11611
    Introduction for position Senior C++ Developer ID 11611 CURRICULUM VITAE Place of Residence Stockholm Profile A C++ programming expert with consistent success on difficult tasks. Expert in practical use of C++ (25+ years), C++11, C++14, C++17 integration with C#, Solid Windows, Linux, Minimal SQL. Dated experience with other languages, including assemblers. Worked in a number of domains, including finance, business and industrial automation, software development tools. Skills & Competences - Expert with consistent success on difficult tasks, dedicated and team lead in various projects. - Problems solving quickly, sometimes instantly; - Manage how to work under pressure. Application Software - Excellent command of the following software: Solid Windows, Linux. Minimal SQL. - Use of C++ (25+ years), C++11, C++14, C++17 integration with C#. Education High School Work experience Sep 2018 – Present Expert C++ Programmer – Personal Project Your tasks/responsibilities - Continuing personal project: writing a parser for C++ language, see motivation in this CV after the Saxo Bank job. - Changed implementation language from Scheme to C++. Implemented a C++ preprocessor of decent quality, extractor of compiler options from a MS Visual Studio projects. - Generated the formal part of the parser from a publicly available grammar. - Implemented “pack rat” optimization for the (recursive descent) parser. - Implementing a parsing context data structure efficient for recursive descent approach; the C++ name lookup algorithm.- Implementing a parsing context data structure efficient for recursive descent approach; the C++ name lookup algorithm. May 2015 – Sep 2018 C++ Programmer - Stockholm Your tasks/responsibilities - Provided C++ expertise to an ambitious company developing a fast database engine and a business software platform.
    [Show full text]
  • Producing Open Source Software How to Run a Successful Free Software Project
    Producing Open Source Software How to Run a Successful Free Software Project Karl Fogel Producing Open Source Software: How to Run a Successful Free Software Project by Karl Fogel Copyright © 2005-2018 Karl Fogel, under the CreativeCommons Attribution-ShareAlike (4.0) license. Version: 2.3098 Home site: http://producingoss.com/ Dedication This book is dedicated to two dear friends without whom it would not have been possible: Karen Under- hill and Jim Blandy. i Table of Contents Preface ............................................................................................................................. vi Why Write This Book? ............................................................................................... vi Who Should Read This Book? .................................................................................... vii Sources ................................................................................................................... vii Acknowledgements ................................................................................................... viii For the first edition (2005) ................................................................................ viii For the second edition (2017) ............................................................................... x Disclaimer .............................................................................................................. xiii 1. Introduction ...................................................................................................................
    [Show full text]
  • Learning Perl Through Examples Part 2 L1110@BUMC 2/22/2017
    www.perl.org Learning Perl Through Examples Part 2 L1110@BUMC 2/22/2017 Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Tutorial Resource Before we start, please take a note - all the codes and www.perl.org supporting documents are accessible through: • http://rcs.bu.edu/examples/perl/tutorials/ Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Sign In Sheet We prepared sign-in sheet for each one to sign www.perl.org We do this for internal management and quality control So please SIGN IN if you haven’t done so Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Evaluation One last piece of information before we start: www.perl.org • DON’T FORGET TO GO TO: • http://rcs.bu.edu/survey/tutorial_evaluation.html Leave your feedback for this tutorial (both good and bad as long as it is honest are welcome. Thank you) Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Today’s Topic • Basics on creating your code www.perl.org • About Today’s Example • Learn Through Example 1 – fanconi_example_io.pl • Learn Through Example 2 – fanconi_example_str_process.pl • Learn Through Example 3 – fanconi_example_gene_anno.pl • Extra Examples (if time permit) Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 www.perl.org Basics on creating your code How to combine specs, tools, modules and knowledge. Yun Shen, Programmer Analyst [email protected] IS&T Research Computing
    [Show full text]
  • Metadefender Core V4.12.2
    MetaDefender Core v4.12.2 © 2018 OPSWAT, Inc. All rights reserved. OPSWAT®, MetadefenderTM and the OPSWAT logo are trademarks of OPSWAT, Inc. All other trademarks, trade names, service marks, service names, and images mentioned and/or used herein belong to their respective owners. Table of Contents About This Guide 13 Key Features of Metadefender Core 14 1. Quick Start with Metadefender Core 15 1.1. Installation 15 Operating system invariant initial steps 15 Basic setup 16 1.1.1. Configuration wizard 16 1.2. License Activation 21 1.3. Scan Files with Metadefender Core 21 2. Installing or Upgrading Metadefender Core 22 2.1. Recommended System Requirements 22 System Requirements For Server 22 Browser Requirements for the Metadefender Core Management Console 24 2.2. Installing Metadefender 25 Installation 25 Installation notes 25 2.2.1. Installing Metadefender Core using command line 26 2.2.2. Installing Metadefender Core using the Install Wizard 27 2.3. Upgrading MetaDefender Core 27 Upgrading from MetaDefender Core 3.x 27 Upgrading from MetaDefender Core 4.x 28 2.4. Metadefender Core Licensing 28 2.4.1. Activating Metadefender Licenses 28 2.4.2. Checking Your Metadefender Core License 35 2.5. Performance and Load Estimation 36 What to know before reading the results: Some factors that affect performance 36 How test results are calculated 37 Test Reports 37 Performance Report - Multi-Scanning On Linux 37 Performance Report - Multi-Scanning On Windows 41 2.6. Special installation options 46 Use RAMDISK for the tempdirectory 46 3. Configuring Metadefender Core 50 3.1. Management Console 50 3.2.
    [Show full text]
  • Linux Lunacy V & Perl Whirl
    SPEAKERS Linux Lunacy V Nicholas Clark Scott Collins & Perl Whirl ’05 Mark Jason Dominus Andrew Dunstan Running Concurrently brian d foy Jon “maddog” Hall Southwestern Caribbean Andrew Morton OCTOBER 2ND TO 9TH, 2005 Ken Pugh Allison Randal Linux Lunacy V and Perl Whirl ’05 run concurrently. Attendees can mix and match, choosing courses from Randal Schwartz both conferences. Doc Searls Ted Ts’o Larry Wall Michael Warfield DAY PORT ARRIVE DEPART CONFERENCE SESSIONS Sunday, Oct 2 Tampa, Florida — 4:00pm 7:15pm, Bon Voyage Party Monday, Oct 3 Cruising The Caribbean — — 8:30am – 5:00pm Tuesday, Oct 4 Grand Cayman 7:00am 4:00pm 4:00pm – 7:30pm Wednesday, Oct 5 Costa Maya, Mexico 10:00am 6:00pm 6:00pm – 7:30pm Thursday, Oct 6 Cozumel, Mexico 7:00am 6:00pm 6:00pm – 7:30pm Friday, Oct 7 Belize City, Belize 7:30am 4:30pm 4:30pm – 8:00pm Saturday, Oct 8 Cruising The Caribbean — — 8:30am – 5:00pm Sunday, Oct 9 Tampa, Florida 8:00am — Perl Whirl ’05 and Linux Lunacy V Perl Whirl ’05 are running concurrently. Attendees can mix and match, choosing courses Seminars at a Glance from both conferences. You may choose any combination Regular Expression Mastery (half day) Programming with Iterators and Generators of full-, half-, or quarter-day seminars Speaker: Mark Jason Dominus Speaker: Mark Jason Dominus (half day) for a total of two-and-one-half Almost everyone has written a regex that failed Sometimes you’ll write a function that takes too (2.5) days’ worth of sessions. The to match something they wanted it to, or that long to run because it produces too much useful conference fee is $995 and includes matched something they thought it shouldn’t, and information.
    [Show full text]
  • EN-Google Hacks.Pdf
    Table of Contents Credits Foreword Preface Chapter 1. Searching Google 1. Setting Preferences 2. Language Tools 3. Anatomy of a Search Result 4. Specialized Vocabularies: Slang and Terminology 5. Getting Around the 10 Word Limit 6. Word Order Matters 7. Repetition Matters 8. Mixing Syntaxes 9. Hacking Google URLs 10. Hacking Google Search Forms 11. Date-Range Searching 12. Understanding and Using Julian Dates 13. Using Full-Word Wildcards 14. inurl: Versus site: 15. Checking Spelling 16. Consulting the Dictionary 17. Consulting the Phonebook 18. Tracking Stocks 19. Google Interface for Translators 20. Searching Article Archives 21. Finding Directories of Information 22. Finding Technical Definitions 23. Finding Weblog Commentary 24. The Google Toolbar 25. The Mozilla Google Toolbar 26. The Quick Search Toolbar 27. GAPIS 28. Googling with Bookmarklets Chapter 2. Google Special Services and Collections 29. Google Directory 30. Google Groups 31. Google Images 32. Google News 33. Google Catalogs 34. Froogle 35. Google Labs Chapter 3. Third-Party Google Services 36. XooMLe: The Google API in Plain Old XML 37. Google by Email 38. Simplifying Google Groups URLs 39. What Does Google Think Of... 40. GooglePeople Chapter 4. Non-API Google Applications 41. Don't Try This at Home 42. Building a Custom Date-Range Search Form 43. Building Google Directory URLs 44. Scraping Google Results 45. Scraping Google AdWords 46. Scraping Google Groups 47. Scraping Google News 48. Scraping Google Catalogs 49. Scraping the Google Phonebook Chapter 5. Introducing the Google Web API 50. Programming the Google Web API with Perl 51. Looping Around the 10-Result Limit 52.
    [Show full text]
  • Appendix a the Ten Commandments for Websites
    Appendix A The Ten Commandments for Websites Welcome to the appendixes! At this stage in your learning, you should have all the basic skills you require to build a high-quality website with insightful consideration given to aspects such as accessibility, search engine optimization, usability, and all the other concepts that web designers and developers think about on a daily basis. Hopefully with all the different elements covered in this book, you now have a solid understanding as to what goes into building a website (much more than code!). The main thing you should take from this book is that you don’t need to be an expert at everything but ensuring that you take the time to notice what’s out there and deciding what will best help your site are among the most important elements of the process. As you leave this book and go on to updating your website over time and perhaps learning new skills, always remember to be brave, take risks (through trial and error), and never feel that things are getting too hard. If you choose to learn skills that were only briefly mentioned in this book, like scripting, or to get involved in using content management systems and web software, go at a pace that you feel comfortable with. With that in mind, let’s go over the 10 most important messages I would personally recommend. After that, I’ll give you some useful resources like important websites for people learning to create for the Internet and handy software. Advice is something many professional designers and developers give out in spades after learning some harsh lessons from what their own bitter experiences.
    [Show full text]
  • Coleman-Coding-Freedom.Pdf
    Coding Freedom !" Coding Freedom THE ETHICS AND AESTHETICS OF HACKING !" E. GABRIELLA COLEMAN PRINCETON UNIVERSITY PRESS PRINCETON AND OXFORD Copyright © 2013 by Princeton University Press Creative Commons Attribution- NonCommercial- NoDerivs CC BY- NC- ND Requests for permission to modify material from this work should be sent to Permissions, Princeton University Press Published by Princeton University Press, 41 William Street, Princeton, New Jersey 08540 In the United Kingdom: Princeton University Press, 6 Oxford Street, Woodstock, Oxfordshire OX20 1TW press.princeton.edu All Rights Reserved At the time of writing of this book, the references to Internet Web sites (URLs) were accurate. Neither the author nor Princeton University Press is responsible for URLs that may have expired or changed since the manuscript was prepared. Library of Congress Cataloging-in-Publication Data Coleman, E. Gabriella, 1973– Coding freedom : the ethics and aesthetics of hacking / E. Gabriella Coleman. p. cm. Includes bibliographical references and index. ISBN 978-0-691-14460-3 (hbk. : alk. paper)—ISBN 978-0-691-14461-0 (pbk. : alk. paper) 1. Computer hackers. 2. Computer programmers. 3. Computer programming—Moral and ethical aspects. 4. Computer programming—Social aspects. 5. Intellectual freedom. I. Title. HD8039.D37C65 2012 174’.90051--dc23 2012031422 British Library Cataloging- in- Publication Data is available This book has been composed in Sabon Printed on acid- free paper. ∞ Printed in the United States of America 1 3 5 7 9 10 8 6 4 2 This book is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE !" We must be free not because we claim freedom, but because we practice it.
    [Show full text]
  • Teach Yourself Perl 5 in 21 Days
    Teach Yourself Perl 5 in 21 days David Till Table of Contents: Introduction ● Who Should Read This Book? ● Special Features of This Book ● Programming Examples ● End-of-Day Q& A and Workshop ● Conventions Used in This Book ● What You'll Learn in 21 Days Week 1 Week at a Glance ● Where You're Going Day 1 Getting Started ● What Is Perl? ● How Do I Find Perl? ❍ Where Do I Get Perl? ❍ Other Places to Get Perl ● A Sample Perl Program ● Running a Perl Program ❍ If Something Goes Wrong ● The First Line of Your Perl Program: How Comments Work ❍ Comments ● Line 2: Statements, Tokens, and <STDIN> ❍ Statements and Tokens ❍ Tokens and White Space ❍ What the Tokens Do: Reading from Standard Input ● Line 3: Writing to Standard Output ❍ Function Invocations and Arguments ● Error Messages ● Interpretive Languages Versus Compiled Languages ● Summary ● Q&A ● Workshop ❍ Quiz ❍ Exercises Day 2 Basic Operators and Control Flow ● Storing in Scalar Variables Assignment ❍ The Definition of a Scalar Variable ❍ Scalar Variable Syntax ❍ Assigning a Value to a Scalar Variable ● Performing Arithmetic ❍ Example of Miles-to-Kilometers Conversion ❍ The chop Library Function ● Expressions ❍ Assignments and Expressions ● Other Perl Operators ● Introduction to Conditional Statements ● The if Statement ❍ The Conditional Expression ❍ The Statement Block ❍ Testing for Equality Using == ❍ Other Comparison Operators ● Two-Way Branching Using if and else ● Multi-Way Branching Using elsif ● Writing Loops Using the while Statement ● Nesting Conditional Statements ● Looping Using
    [Show full text]