SlideShare a Scribd company logo
1 of 23
Perl  簡介 Sway   2010/12/28
equals(  ,  ) Cross-platform, open-source, scripting language,  multi-paradigm, dynamic typing, statement ratio: 6 There should be one way There’s more than one way Guido van Rossum Larry Wall 1991 1987 Python Perl Easy Difficult
Perl  特色 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CPAN ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
you must be joking! http://www.strombergers.com/python/ my @list = ('a', 'b', 'c');  my %hash;  $hash{‘letters'} = list;  print "@{$hash{‘letters'}}";   list = ['a', 'b', 'c']  hash = {}  hash[‘letters'] = list  print hash[‘letters']   package Person;  use strict;  sub new {  my $class = shift;  my $age = shift or die "Must pass age";  my $rSelf = {'age' => $age};  bless ($rSelf, $class);  return $rSelf;  }   class Person:  def __init__(self, age):  self.age = age   @list = ( [‘a’, ’b’, ’c’], [1, 2, 3] ); print “@{$list[0]}”;  list = [ [‘a’, ’b’, ’c’], [1, 2, 3] ] print list[0]
More Perl bashing… http://www.strombergers.com/python/ sub add { $_[0] + $_[1];  }   def add(a, b): return a + b sub add { my ($a, $b) = _@;  return $a + $b;  }   sub add { my $a = shift; my $b = shift; return $a + $b;  }   def diff(a, b): return len(a) - len(b) sub diff { my ($aref, $bref) = _@; my (@a) = @$aref;  my (@b) = @$bref;   return scalar(@a) + scalar(@b); } sub add($, $) { local ($a, $b) = _@;  return $a + $b;  }
More Perl…
  CGI Perl is widely used for web programming
Perl Syntax ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
one of ten Perl myths http://www.perl.com/pub/a/2000/01/10PerlMyths.html “… Perl works the way you do…”   “… That's one, fairly natural way to think about it…”   while (<>) {  s/(.*):(.*)/$2:$1/;  print;  }   Swap two sections of a string: “aaa:bbb” -> “bbb:aaa”   for line in file: line = line.strip() first, second = line.split(‘:’) print second+’:’+first while (<>) {  chomp;  ($first, $second) = split /:/;  print $second, &quot;:&quot;, $first, &quot;&quot;;  }   “… we can happily consign the idea that ‘Perl is hard’ to mythology.”   from re import sub for line in file: print sub(‘(.*):(.*)’, r’:’, line)
Scalars ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Arrays ,[object Object],[object Object],[object Object]
Hashes ,[object Object],[object Object],[object Object],[object Object],[object Object]
Complex data types ,[object Object],[object Object],[object Object],[object Object]
Complex data types   ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Comparison ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pattern Matching ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Conditional constructs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Conditional constructs
Looping constructs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Looping constructs
Subroutines ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Perl 6 ,[object Object]

More Related Content

What's hot

Wx::Perl::Smart
Wx::Perl::SmartWx::Perl::Smart
Wx::Perl::Smartlichtkind
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxEleanor McHugh
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHPpwmosquito
 
Class 5 - PHP Strings
Class 5 - PHP StringsClass 5 - PHP Strings
Class 5 - PHP StringsAhmed Swilam
 
8 arrays and pointers
8  arrays and pointers8  arrays and pointers
8 arrays and pointersMomenMostafa
 
Unit 1-array,lists and hashes
Unit 1-array,lists and hashesUnit 1-array,lists and hashes
Unit 1-array,lists and hashessana mateen
 
Introduction to Perl - Day 1
Introduction to Perl - Day 1Introduction to Perl - Day 1
Introduction to Perl - Day 1Dave Cross
 
How to write code you won't hate tomorrow
How to write code you won't hate tomorrowHow to write code you won't hate tomorrow
How to write code you won't hate tomorrowPete McFarlane
 
Write Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 HoursWrite Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 HoursPhillip Trelford
 
Perl 6 in Context
Perl 6 in ContextPerl 6 in Context
Perl 6 in Contextlichtkind
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statementsMomenMostafa
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tourSimon Proctor
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tourSimon Proctor
 
9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string libraryMomenMostafa
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and GoEleanor McHugh
 

What's hot (20)

Python
PythonPython
Python
 
Wx::Perl::Smart
Wx::Perl::SmartWx::Perl::Smart
Wx::Perl::Smart
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
 
Class 5 - PHP Strings
Class 5 - PHP StringsClass 5 - PHP Strings
Class 5 - PHP Strings
 
8 arrays and pointers
8  arrays and pointers8  arrays and pointers
8 arrays and pointers
 
Unit vii wp ppt
Unit vii wp pptUnit vii wp ppt
Unit vii wp ppt
 
Unit 1-array,lists and hashes
Unit 1-array,lists and hashesUnit 1-array,lists and hashes
Unit 1-array,lists and hashes
 
Introduction to Perl - Day 1
Introduction to Perl - Day 1Introduction to Perl - Day 1
Introduction to Perl - Day 1
 
How to write code you won't hate tomorrow
How to write code you won't hate tomorrowHow to write code you won't hate tomorrow
How to write code you won't hate tomorrow
 
Neatly folding-a-tree
Neatly folding-a-treeNeatly folding-a-tree
Neatly folding-a-tree
 
Write Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 HoursWrite Your Own Compiler in 24 Hours
Write Your Own Compiler in 24 Hours
 
Perl 6 in Context
Perl 6 in ContextPerl 6 in Context
Perl 6 in Context
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string library
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
 
Go a crash course
Go   a crash courseGo   a crash course
Go a crash course
 
F# intro
F# introF# intro
F# intro
 

Viewers also liked

Deber 1 Gabriela Bermúdez
Deber 1 Gabriela BermúdezDeber 1 Gabriela Bermúdez
Deber 1 Gabriela Bermúdezgabbyb_b
 
Sample Analyze123 Google Analytics Report (Premium)
Sample Analyze123 Google Analytics Report (Premium)Sample Analyze123 Google Analytics Report (Premium)
Sample Analyze123 Google Analytics Report (Premium)Analyze123
 
Magnolia's Magnificent Adventure
Magnolia's Magnificent AdventureMagnolia's Magnificent Adventure
Magnolia's Magnificent Adventurecoolstuff
 
Tears of a Woman
Tears of a WomanTears of a Woman
Tears of a Womanartemis
 
Formation clé du-ecommerce dans l'immobilier
Formation clé du-ecommerce dans l'immobilier Formation clé du-ecommerce dans l'immobilier
Formation clé du-ecommerce dans l'immobilier Jérôme Avner MAMAN
 
www.makidance.com
www.makidance.comwww.makidance.com
www.makidance.commaki
 
Plantilla presentación
Plantilla presentaciónPlantilla presentación
Plantilla presentaciónJoseC.Valverde
 
Hong Kong PhD Fellowships 2016/17
Hong Kong PhD Fellowships 2016/17Hong Kong PhD Fellowships 2016/17
Hong Kong PhD Fellowships 2016/172016
 
Description of the earth
Description of the earthDescription of the earth
Description of the earthpavopavo
 
Domselaar GMI8 Beijing Canadian WGS Surveillance Experience
Domselaar GMI8 Beijing Canadian WGS Surveillance ExperienceDomselaar GMI8 Beijing Canadian WGS Surveillance Experience
Domselaar GMI8 Beijing Canadian WGS Surveillance ExperienceIRIDA_community
 
Docker, Continuous Integration, and You
Docker, Continuous Integration, and YouDocker, Continuous Integration, and You
Docker, Continuous Integration, and YouAtlassian
 
Caption story project
Caption story projectCaption story project
Caption story projectsofiamckentry
 
Entidades financieras sometidas a la supervisión de la
Entidades financieras sometidas a la supervisión de laEntidades financieras sometidas a la supervisión de la
Entidades financieras sometidas a la supervisión de laColegioEfeso
 

Viewers also liked (19)

Formation Responsable ecommerce
Formation Responsable ecommerceFormation Responsable ecommerce
Formation Responsable ecommerce
 
Deber 1 Gabriela Bermúdez
Deber 1 Gabriela BermúdezDeber 1 Gabriela Bermúdez
Deber 1 Gabriela Bermúdez
 
Sample Analyze123 Google Analytics Report (Premium)
Sample Analyze123 Google Analytics Report (Premium)Sample Analyze123 Google Analytics Report (Premium)
Sample Analyze123 Google Analytics Report (Premium)
 
Magnolia's Magnificent Adventure
Magnolia's Magnificent AdventureMagnolia's Magnificent Adventure
Magnolia's Magnificent Adventure
 
Tears of a Woman
Tears of a WomanTears of a Woman
Tears of a Woman
 
Formation clé du-ecommerce dans l'immobilier
Formation clé du-ecommerce dans l'immobilier Formation clé du-ecommerce dans l'immobilier
Formation clé du-ecommerce dans l'immobilier
 
www.makidance.com
www.makidance.comwww.makidance.com
www.makidance.com
 
MCU compare
MCU compareMCU compare
MCU compare
 
Shantosh Bhatt CV
Shantosh Bhatt CV Shantosh Bhatt CV
Shantosh Bhatt CV
 
Plantilla presentación
Plantilla presentaciónPlantilla presentación
Plantilla presentación
 
Hong Kong PhD Fellowships 2016/17
Hong Kong PhD Fellowships 2016/17Hong Kong PhD Fellowships 2016/17
Hong Kong PhD Fellowships 2016/17
 
Formation "clé du-ecommerce"
Formation "clé du-ecommerce"Formation "clé du-ecommerce"
Formation "clé du-ecommerce"
 
Formation e-tourisme en ligne
Formation e-tourisme en ligneFormation e-tourisme en ligne
Formation e-tourisme en ligne
 
Description of the earth
Description of the earthDescription of the earth
Description of the earth
 
Domselaar GMI8 Beijing Canadian WGS Surveillance Experience
Domselaar GMI8 Beijing Canadian WGS Surveillance ExperienceDomselaar GMI8 Beijing Canadian WGS Surveillance Experience
Domselaar GMI8 Beijing Canadian WGS Surveillance Experience
 
CICD by Teerapat
CICD by TeerapatCICD by Teerapat
CICD by Teerapat
 
Docker, Continuous Integration, and You
Docker, Continuous Integration, and YouDocker, Continuous Integration, and You
Docker, Continuous Integration, and You
 
Caption story project
Caption story projectCaption story project
Caption story project
 
Entidades financieras sometidas a la supervisión de la
Entidades financieras sometidas a la supervisión de laEntidades financieras sometidas a la supervisión de la
Entidades financieras sometidas a la supervisión de la
 

Similar to Introduction to Perl

Perl training-in-navi mumbai
Perl training-in-navi mumbaiPerl training-in-navi mumbai
Perl training-in-navi mumbaivibrantuser
 
Good Evils In Perl
Good Evils In PerlGood Evils In Perl
Good Evils In PerlKang-min Liu
 
You Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsYou Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsRoy Zimmer
 
Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Kang-min Liu
 
Learning Perl 6
Learning Perl 6 Learning Perl 6
Learning Perl 6 brian d foy
 
Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)brian d foy
 
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...Codemotion
 
Introduction to regular expressions
Introduction to regular expressionsIntroduction to regular expressions
Introduction to regular expressionsBen Brumfield
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangSean Cribbs
 
Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...
Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...
Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...Andrea Telatin
 
Introduction to Perl - Day 2
Introduction to Perl - Day 2Introduction to Perl - Day 2
Introduction to Perl - Day 2Dave Cross
 
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.Workhorse Computing
 

Similar to Introduction to Perl (20)

Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
Perl training-in-navi mumbai
Perl training-in-navi mumbaiPerl training-in-navi mumbai
Perl training-in-navi mumbai
 
Good Evils In Perl
Good Evils In PerlGood Evils In Perl
Good Evils In Perl
 
You Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager NeedsYou Can Do It! Start Using Perl to Handle Your Voyager Needs
You Can Do It! Start Using Perl to Handle Your Voyager Needs
 
Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)
 
First steps in PERL
First steps in PERLFirst steps in PERL
First steps in PERL
 
Perl Introduction
Perl IntroductionPerl Introduction
Perl Introduction
 
Perl Presentation
Perl PresentationPerl Presentation
Perl Presentation
 
Learning Perl 6
Learning Perl 6 Learning Perl 6
Learning Perl 6
 
Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01
 
Cleancode
CleancodeCleancode
Cleancode
 
Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)
 
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...
 
Introduction to regular expressions
Introduction to regular expressionsIntroduction to regular expressions
Introduction to regular expressions
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
 
Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...
Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...
Bioinformatica: Esercizi su Perl, espressioni regolari e altre amenità (BMR G...
 
Introduction to Perl - Day 2
Introduction to Perl - Day 2Introduction to Perl - Day 2
Introduction to Perl - Day 2
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 
Php2
Php2Php2
Php2
 
Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.Perl6 Regexen: Reduce the line noise in your code.
Perl6 Regexen: Reduce the line noise in your code.
 

More from Sway Wang

Design patterns and MV
Design patterns and MVDesign patterns and MV
Design patterns and MVSway Wang
 
Duck Typing and Multiple Inheritance
Duck Typing and Multiple InheritanceDuck Typing and Multiple Inheritance
Duck Typing and Multiple InheritanceSway Wang
 
How to select password(Chinese)
How to select password(Chinese)How to select password(Chinese)
How to select password(Chinese)Sway Wang
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonSway Wang
 
Agile development
Agile developmentAgile development
Agile developmentSway Wang
 

More from Sway Wang (9)

Code review
Code reviewCode review
Code review
 
Refactoring
RefactoringRefactoring
Refactoring
 
Solid
SolidSolid
Solid
 
Design patterns and MV
Design patterns and MVDesign patterns and MV
Design patterns and MV
 
Duck Typing and Multiple Inheritance
Duck Typing and Multiple InheritanceDuck Typing and Multiple Inheritance
Duck Typing and Multiple Inheritance
 
How to select password(Chinese)
How to select password(Chinese)How to select password(Chinese)
How to select password(Chinese)
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Agile development
Agile developmentAgile development
Agile development
 
Libusb
LibusbLibusb
Libusb
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Introduction to Perl

  • 1. Perl 簡介 Sway 2010/12/28
  • 2. equals( , ) Cross-platform, open-source, scripting language, multi-paradigm, dynamic typing, statement ratio: 6 There should be one way There’s more than one way Guido van Rossum Larry Wall 1991 1987 Python Perl Easy Difficult
  • 3.
  • 4.
  • 5. you must be joking! http://www.strombergers.com/python/ my @list = ('a', 'b', 'c'); my %hash; $hash{‘letters'} = list; print &quot;@{$hash{‘letters'}}&quot;; list = ['a', 'b', 'c'] hash = {} hash[‘letters'] = list print hash[‘letters'] package Person; use strict; sub new { my $class = shift; my $age = shift or die &quot;Must pass age&quot;; my $rSelf = {'age' => $age}; bless ($rSelf, $class); return $rSelf; } class Person: def __init__(self, age): self.age = age @list = ( [‘a’, ’b’, ’c’], [1, 2, 3] ); print “@{$list[0]}”; list = [ [‘a’, ’b’, ’c’], [1, 2, 3] ] print list[0]
  • 6. More Perl bashing… http://www.strombergers.com/python/ sub add { $_[0] + $_[1]; } def add(a, b): return a + b sub add { my ($a, $b) = _@; return $a + $b; } sub add { my $a = shift; my $b = shift; return $a + $b; } def diff(a, b): return len(a) - len(b) sub diff { my ($aref, $bref) = _@; my (@a) = @$aref; my (@b) = @$bref; return scalar(@a) + scalar(@b); } sub add($, $) { local ($a, $b) = _@; return $a + $b; }
  • 8.   CGI Perl is widely used for web programming
  • 9.
  • 10. one of ten Perl myths http://www.perl.com/pub/a/2000/01/10PerlMyths.html “… Perl works the way you do…” “… That's one, fairly natural way to think about it…” while (<>) { s/(.*):(.*)/$2:$1/; print; } Swap two sections of a string: “aaa:bbb” -> “bbb:aaa” for line in file: line = line.strip() first, second = line.split(‘:’) print second+’:’+first while (<>) { chomp; ($first, $second) = split /:/; print $second, &quot;:&quot;, $first, &quot;&quot;; } “… we can happily consign the idea that ‘Perl is hard’ to mythology.” from re import sub for line in file: print sub(‘(.*):(.*)’, r’:’, line)
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 20.
  • 22.
  • 23.