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

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
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
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 

Recently uploaded (20)

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
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
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 

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.