SlideShare una empresa de Scribd logo
1 de 10
Perl  Programming
Topics Introduction to Perl Variables Scalars Arrays Hashes Regular Expressions
Introduction Perl – Practical Extraction and Reporting Language Developed in 1987 by  Larry Wall Filenames should have the extension of .pl Runs under windows and linux The first line of perl under linux is  #!/usr/bin/perl The first line of perl under windows is #!c:/perl/bin/perl.exe
Introduction Perl scripts are interpreted in the command or shell prompt and even in the browser.  If it in the browser, a Http header should be set like print “Content-type: text/html ”; First example #! C:/perl/bin/perl.exe print “Content-type: text/html ”; Print “Hello World “;
Introduction Go to the command prompt  and execute the command  perl filename.pl In the browser, type http://localhost/filename.pl
Perl Variables Scalars ($) Numbers or Strings or reference Started with a $ symbol  Ex. $string=“Hello “; $a=200; $x=2**3; Arrays (@) List of scalar data Defined by an @ symbol @s=(“hello”, ”world”); Hashes (%) Complex list with both a key and a value part for each element of the list. Defined by a % symbol %ages = ("Jerry", 45, "Tom", 22, "Vickie", 38);
Scalars $x = 12345; # integer  $x = 12345.67; # floating point  $x = 6.02e23; # scientific notation  $x = 4_294_967_296; # underline for legibility  $x = 0377; # octal  $x = 0xffff; # hexadecimal  $x = 0b1100_0000; # binary $x=“Hello” # string literals Double quotes – variables are interpolated Single quotes – variables are not interpolated
Arrays @a=(“hi”,”Hello”,”there”); Print @a; $c=pop @a; # last element “there” is stored in c Push(@a,”here”); Print @a; Print $a[0]; #index starts at 0, so prints hi
Hashes Uses a key value pair Key is usually a string literal Example %hash=(“Tom”,33,”mike”,23,”john”,19); Print %hash; @k=keys %hash; @v=values %hash; $count=keys %hash; While(($keys=>$values)=each %hash) {print “$keys=>$values”.”<br/>”;}
Regular Expression Matches a word or a phrase or even a character trying to match a pattern Meta characters Pattern Modifiers

Más contenido relacionado

Destacado

Destacado (9)

ShravanTamaskar_Thesis
ShravanTamaskar_ThesisShravanTamaskar_Thesis
ShravanTamaskar_Thesis
 
Industrial Networks: the Choices for Real Time Motion Control
Industrial Networks: the Choices for Real Time Motion ControlIndustrial Networks: the Choices for Real Time Motion Control
Industrial Networks: the Choices for Real Time Motion Control
 
Ether cat introduction_pt
Ether cat introduction_ptEther cat introduction_pt
Ether cat introduction_pt
 
Kernel Recipes 2014 - Testing Video4Linux Applications and Drivers
Kernel Recipes 2014 - Testing Video4Linux Applications and DriversKernel Recipes 2014 - Testing Video4Linux Applications and Drivers
Kernel Recipes 2014 - Testing Video4Linux Applications and Drivers
 
Device drivers tsp
Device drivers tspDevice drivers tsp
Device drivers tsp
 
Kernel Recipes 2013 - Overview display in the Linux kernel
Kernel Recipes 2013 - Overview display in the Linux kernelKernel Recipes 2013 - Overview display in the Linux kernel
Kernel Recipes 2013 - Overview display in the Linux kernel
 
Design and development of MIL-STD-1553 based engineering model
Design and development of MIL-STD-1553 based engineering modelDesign and development of MIL-STD-1553 based engineering model
Design and development of MIL-STD-1553 based engineering model
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1
 

Similar a Perl programming tsp

Using Unix
Using UnixUsing Unix
Using Unix
Dr.Ravi
 

Similar a Perl programming tsp (20)

Perl
PerlPerl
Perl
 
Perl Basics with Examples
Perl Basics with ExamplesPerl Basics with Examples
Perl Basics with Examples
 
Introduction to perl_ a scripting language
Introduction to perl_ a scripting languageIntroduction to perl_ a scripting language
Introduction to perl_ a scripting language
 
Unit 1-introduction to perl
Unit 1-introduction to perlUnit 1-introduction to perl
Unit 1-introduction to perl
 
perl lauange
perl lauangeperl lauange
perl lauange
 
Pearl
PearlPearl
Pearl
 
Learn PERL at ASIT
Learn PERL at ASITLearn PERL at ASIT
Learn PERL at ASIT
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.ppt
 
Using Unix
Using UnixUsing Unix
Using Unix
 
Perl bhargav
Perl bhargavPerl bhargav
Perl bhargav
 
Introduction to Modern Perl
Introduction to Modern PerlIntroduction to Modern Perl
Introduction to Modern Perl
 
Day1
Day1Day1
Day1
 
Intro to Perl
Intro to PerlIntro to Perl
Intro to Perl
 
Choosing a Templating System
Choosing a Templating SystemChoosing a Templating System
Choosing a Templating System
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
Introduction to writing readable and maintainable Perl
Introduction to writing readable and maintainable PerlIntroduction to writing readable and maintainable Perl
Introduction to writing readable and maintainable Perl
 
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
 
Perl Reference.ppt
Perl Reference.pptPerl Reference.ppt
Perl Reference.ppt
 
Php a dynamic web scripting language
Php   a dynamic web scripting languagePhp   a dynamic web scripting language
Php a dynamic web scripting language
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 

Más de Pradeep Kumar TS

Más de Pradeep Kumar TS (20)

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and Footprint
 
Open book Examination
Open book ExaminationOpen book Examination
Open book Examination
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
 
Protothreads
ProtothreadsProtothreads
Protothreads
 
6LoWPAN
6LoWPAN 6LoWPAN
6LoWPAN
 
Software Defined Networks
Software Defined NetworksSoftware Defined Networks
Software Defined Networks
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication Protocols
 
IoT Applications
IoT ApplicationsIoT Applications
IoT Applications
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
 
Mannasim for NS2
Mannasim for NS2Mannasim for NS2
Mannasim for NS2
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
 
Installation of ns2
Installation of ns2Installation of ns2
Installation of ns2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3
 
Tracing and awk in ns2
Tracing and awk in ns2Tracing and awk in ns2
Tracing and awk in ns2
 
Virtual classrooms and labs using Big Blue Button
Virtual classrooms and labs using Big Blue ButtonVirtual classrooms and labs using Big Blue Button
Virtual classrooms and labs using Big Blue Button
 

Último

Último (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

Perl programming tsp

  • 2. Topics Introduction to Perl Variables Scalars Arrays Hashes Regular Expressions
  • 3. Introduction Perl – Practical Extraction and Reporting Language Developed in 1987 by Larry Wall Filenames should have the extension of .pl Runs under windows and linux The first line of perl under linux is #!/usr/bin/perl The first line of perl under windows is #!c:/perl/bin/perl.exe
  • 4. Introduction Perl scripts are interpreted in the command or shell prompt and even in the browser. If it in the browser, a Http header should be set like print “Content-type: text/html ”; First example #! C:/perl/bin/perl.exe print “Content-type: text/html ”; Print “Hello World “;
  • 5. Introduction Go to the command prompt and execute the command perl filename.pl In the browser, type http://localhost/filename.pl
  • 6. Perl Variables Scalars ($) Numbers or Strings or reference Started with a $ symbol Ex. $string=“Hello “; $a=200; $x=2**3; Arrays (@) List of scalar data Defined by an @ symbol @s=(“hello”, ”world”); Hashes (%) Complex list with both a key and a value part for each element of the list. Defined by a % symbol %ages = ("Jerry", 45, "Tom", 22, "Vickie", 38);
  • 7. Scalars $x = 12345; # integer $x = 12345.67; # floating point $x = 6.02e23; # scientific notation $x = 4_294_967_296; # underline for legibility $x = 0377; # octal $x = 0xffff; # hexadecimal $x = 0b1100_0000; # binary $x=“Hello” # string literals Double quotes – variables are interpolated Single quotes – variables are not interpolated
  • 8. Arrays @a=(“hi”,”Hello”,”there”); Print @a; $c=pop @a; # last element “there” is stored in c Push(@a,”here”); Print @a; Print $a[0]; #index starts at 0, so prints hi
  • 9. Hashes Uses a key value pair Key is usually a string literal Example %hash=(“Tom”,33,”mike”,23,”john”,19); Print %hash; @k=keys %hash; @v=values %hash; $count=keys %hash; While(($keys=>$values)=each %hash) {print “$keys=>$values”.”<br/>”;}
  • 10. Regular Expression Matches a word or a phrase or even a character trying to match a pattern Meta characters Pattern Modifiers