SlideShare a Scribd company logo
Introduction to Perl Programming
www.collaborationtech.co.in
Bengaluru INDIA
Presentation By
Ramananda M.S Rao
Content
Content
Overview
Get Started
Functions & Subroutines
Regular Expressions and Patterns
Basic Input and Output
Formatting and Reporting
System Interaction and Process
OOPS Concepts
Modules ,Packages and Namespaces
Project
About Us
www.collaborationtech.co.in
Overview
 Perl is an interpreted language, meaning that a control
program that understands the semantics of the language
and its components (the interpreter) executes program
components individually as they are encountered in the
control flow.
 Interpreted execution makes Perl flexible, convenient,
and fast for programming, with some penalty paid in
execution speed.
 Perl programs are often called scripts because of its
historical development as an extension of the Unix
command-level command scripting notations.
www.collaborationtech.co.in
Get Started
#!/usr/bin/perl
# This will print "Hello, World"
print "Hello, worldn";
#!/usr/bin/perl
print("Hello, worldn");
print "Hello, worldn";
#!/usr/bin/perl
print "Hello, worldn";
print 'Hello, worldn';
www.collaborationtech.co.in
Data Types
#!/usr/bin/perl
$number = 2;
$st1 = ‘one fine $number day’;
$st2 = “$number fine day n”;
print $st2; print “$st1n”;
#!/usr/bin/perl
$v1 = 127;
$v1 = $v1 . ", and more !!"; # . Indicates to concatenate two data
print $v1, “n”;
$v1 = 127; print $v1 + "151 ", "n";
print $v1 + ", and more !!", "n";
www.collaborationtech.co.in
Data Types
#!/usr/bin/perl
my @array = (10, 20, 30);
# Assign list variables to scalar variables
my $scalar1; my $scalar2; my $scalar3;
($scalar1, $scalar2, $scalar3) = @array;
print "Scalar one is $scalar1n";
print "Scalar two is $scalar2n";
print "Scalar three is $scalar3n";
Adding to an Array
#!/usr/bin/perl
# addelem.pl
use warnings; use strict;
my @array1 = (1, 2, 3);
my @array2 = (@array1, 4, 5, 6);
print "@array2n";
@array2 = (3, 5, 7, 9);
@array2 = (1, @array2, 11);
print "@array2n";
>perl addelem.pl
1 2 3 4 5 6
1 3 5 7 9 11
www.collaborationtech.co.in
Control Structure
If / elsif / else
if ($thresh < 10) {
# … the ‘then’ block of the conditional
} elsif ($thresh < 20) {
# the next block in the decision tree
} elsif ($thresh < 40) {
# and the next…
} else {
# the final clause catches what falls through
}
#!/usr/bin/perl
# conditional.pl
use strict; use warnings;
my ($x, $y) = @ARGV;
if ($x == $y) { print "equaln"; }
else { print "not equaln"; }
www.collaborationtech.co.in
Functions and Subroutines
func2.pl:
firstSub(1, 2, 3, 4, 5, 6);
firstSub(1..3);
firstSub("A".."Z");
sub firstSub() {
$numParameters = @_ ;
print("The number of parameters is $numParametersn");
}
func4.pl|:
@array = (0..5);
print("Before function call, array = @arrayn");
firstSub(@array);
print("After function call, array = @arrayn");
sub firstSub{ $_[0] = "A"; $_[1] = "B";}
This program prints:
Before function call, array = 0 1 2 3 4 5
After function call, array = A B 2 3 4 5}
www.collaborationtech.co.in
Functions and Subroutines
#!/usr/bin/perl
# gc.pl
use strict; use warnings;
while (my $seq = <>) {
chomp($seq);
gc($seq); 8. }
sub gc {
my ($seq) = @_;
$seq = uc($seq); # convert to upper case to be sure
my $g = $seq =~ tr/G/G/;
my $c = $seq =~ tr/C/C/;
my $gc = ($g + $c) / length($seq);
print "GC% = $gcn";
} };
www.collaborationtech.co.in
Modules
 A module is a package contained within an external
file of the same name
.pm extension
file MyMod.pm:
package MyMod; #no shebang!!
use strict;
use warnings;
our ($foo, $bar, $baz);
($foo, $bar) = split /s+/,
'Hello World';
$baz = 42;
1;
www.collaborationtech.co.in
Packages
#!/usr/bin/perl
use warnings; #note no use strict!
$foo = 'Hello'; #sets $main::foo
package Bar;
$foo = 'World'; #sets $Bar::foo
package Lalli;
print "$main::foo $Bar::foon";
prints "Hello Worldn"
www.collaborationtech.co.in
Follow us on Social
Facebook: https://www.facebook.com/collaborationtechnologies/
Twitter : https://twitter.com/collaboration09
Google Plus : https://plus.google.com/100704494006819853579
LinkedIn : https://www.linkedin.com/in/ramananda-rao-a2012545
Instagram : https://instagram.com/collaborationtechnologies
YouTube :
https://www.youtube.com/channel/UCm9nK56LRbWSqcYWbzs8CUg
Skype : facebook:ramananda.rao.7
WhatsApp : +91 9886272445
www.collaborationtech.co.in
THANK YOU
About Us

More Related Content

PPTX
Functuon
KEY
Intermediate PHP
ODP
The promise of asynchronous PHP
ODP
PHP Tips for certification - OdW13
PPTX
Php string function
PPTX
Unix shell scripts
PDF
OSDC.TW - Gutscript for PHP haters
Functuon
Intermediate PHP
The promise of asynchronous PHP
PHP Tips for certification - OdW13
Php string function
Unix shell scripts
OSDC.TW - Gutscript for PHP haters

What's hot (19)

PDF
Web 8 | Introduction to PHP
PDF
Web 4 | Core JavaScript
PDF
Data Types In PHP
PPT
Class 2 - Introduction to PHP
PDF
Powershell notes
PPT
Class 3 - PHP Functions
PDF
Perl IO
PPTX
PHP function
PDF
Code Generation in PHP - PHPConf 2015
KEY
Good Evils In Perl (Yapc Asia)
PDF
Learning Perl 6 (NPW 2007)
PDF
Linux shell script-1
PDF
Zend Certification Preparation Tutorial
PDF
Learning Perl 6
PDF
CyberLink LabelPrint 2.5 Exploitation Process
PPTX
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
PDF
Orlando BarCamp Why Javascript Doesn't Suck
PDF
Melhorando sua API com DSLs
PPT
Chap06
Web 8 | Introduction to PHP
Web 4 | Core JavaScript
Data Types In PHP
Class 2 - Introduction to PHP
Powershell notes
Class 3 - PHP Functions
Perl IO
PHP function
Code Generation in PHP - PHPConf 2015
Good Evils In Perl (Yapc Asia)
Learning Perl 6 (NPW 2007)
Linux shell script-1
Zend Certification Preparation Tutorial
Learning Perl 6
CyberLink LabelPrint 2.5 Exploitation Process
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Orlando BarCamp Why Javascript Doesn't Suck
Melhorando sua API com DSLs
Chap06
Ad

Viewers also liked (20)

PDF
ODP
Introduction to Perl - Day 2
PPT
LPW: Beginners Perl
PPTX
Recovered file 1
DOCX
MCR CV Ramiro Terán (2)
PPTX
Costume
 
ODP
Introduction to Perl - Day 1
PPTX
Introduction to HTML5
PPTX
Introduction to Node.JS
PPTX
Introduction to Advanced Javascript
PPTX
Introduction to PHP
PPTX
contraception and infertility
PPTX
Bones, muscles and joints
PPTX
Introduction to JavaScript Programming
PPTX
Introduction to JSON & AJAX
PPTX
Introduction to Database SQL & PL/SQL
PPTX
Introduction to JPA Framework
PPTX
Introduction to jQuery
PDF
Captains of industry : le monde des affaires subit déjà les conséquences du B...
PDF
Fotografía profesional para empresas
Introduction to Perl - Day 2
LPW: Beginners Perl
Recovered file 1
MCR CV Ramiro Terán (2)
Costume
 
Introduction to Perl - Day 1
Introduction to HTML5
Introduction to Node.JS
Introduction to Advanced Javascript
Introduction to PHP
contraception and infertility
Bones, muscles and joints
Introduction to JavaScript Programming
Introduction to JSON & AJAX
Introduction to Database SQL & PL/SQL
Introduction to JPA Framework
Introduction to jQuery
Captains of industry : le monde des affaires subit déjà les conséquences du B...
Fotografía profesional para empresas
Ad

Similar to Introduction to Perl Programming (20)

PPT
Introduction to perl_ a scripting language
PPT
name name2 n2.ppt
PPT
ppt2
PPT
name name2 n
PPT
ppt30
PPT
ppt18
PPT
Ruby for Perl Programmers
PPT
name name2 n2
PPT
name name2 n
PPT
ppt21
PPT
name name2 n
PPT
ppt17
PPT
ppt7
PPT
ppt9
PPT
test ppt
PPT
Bioinformatica 29-09-2011-p1-introduction
PPT
Introduction to perl scripting______.ppt
PPT
Perl Basics with Examples
PPT
Shell Scripts
PPT
Shell programming
Introduction to perl_ a scripting language
name name2 n2.ppt
ppt2
name name2 n
ppt30
ppt18
Ruby for Perl Programmers
name name2 n2
name name2 n
ppt21
name name2 n
ppt17
ppt7
ppt9
test ppt
Bioinformatica 29-09-2011-p1-introduction
Introduction to perl scripting______.ppt
Perl Basics with Examples
Shell Scripts
Shell programming

More from Collaboration Technologies (8)

PPTX
Introduction to Core Java Programming
PPTX
Introduction to AngularJS
PPTX
Introduction to Bootstrap
PPTX
Introduction to Hibernate Framework
PPTX
Introduction to HTML4
PPTX
Introduction to Python Basics Programming
PPTX
Introduction to Spring Framework
PPTX
Introduction to Struts 2
Introduction to Core Java Programming
Introduction to AngularJS
Introduction to Bootstrap
Introduction to Hibernate Framework
Introduction to HTML4
Introduction to Python Basics Programming
Introduction to Spring Framework
Introduction to Struts 2

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Cloud computing and distributed systems.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Cloud computing and distributed systems.
Digital-Transformation-Roadmap-for-Companies.pptx
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I
MIND Revenue Release Quarter 2 2025 Press Release
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Spectral efficient network and resource selection model in 5G networks

Introduction to Perl Programming

  • 1. Introduction to Perl Programming www.collaborationtech.co.in Bengaluru INDIA Presentation By Ramananda M.S Rao
  • 2. Content Content Overview Get Started Functions & Subroutines Regular Expressions and Patterns Basic Input and Output Formatting and Reporting System Interaction and Process OOPS Concepts Modules ,Packages and Namespaces Project About Us www.collaborationtech.co.in
  • 3. Overview  Perl is an interpreted language, meaning that a control program that understands the semantics of the language and its components (the interpreter) executes program components individually as they are encountered in the control flow.  Interpreted execution makes Perl flexible, convenient, and fast for programming, with some penalty paid in execution speed.  Perl programs are often called scripts because of its historical development as an extension of the Unix command-level command scripting notations. www.collaborationtech.co.in
  • 4. Get Started #!/usr/bin/perl # This will print "Hello, World" print "Hello, worldn"; #!/usr/bin/perl print("Hello, worldn"); print "Hello, worldn"; #!/usr/bin/perl print "Hello, worldn"; print 'Hello, worldn'; www.collaborationtech.co.in
  • 5. Data Types #!/usr/bin/perl $number = 2; $st1 = ‘one fine $number day’; $st2 = “$number fine day n”; print $st2; print “$st1n”; #!/usr/bin/perl $v1 = 127; $v1 = $v1 . ", and more !!"; # . Indicates to concatenate two data print $v1, “n”; $v1 = 127; print $v1 + "151 ", "n"; print $v1 + ", and more !!", "n"; www.collaborationtech.co.in
  • 6. Data Types #!/usr/bin/perl my @array = (10, 20, 30); # Assign list variables to scalar variables my $scalar1; my $scalar2; my $scalar3; ($scalar1, $scalar2, $scalar3) = @array; print "Scalar one is $scalar1n"; print "Scalar two is $scalar2n"; print "Scalar three is $scalar3n"; Adding to an Array #!/usr/bin/perl # addelem.pl use warnings; use strict; my @array1 = (1, 2, 3); my @array2 = (@array1, 4, 5, 6); print "@array2n"; @array2 = (3, 5, 7, 9); @array2 = (1, @array2, 11); print "@array2n"; >perl addelem.pl 1 2 3 4 5 6 1 3 5 7 9 11 www.collaborationtech.co.in
  • 7. Control Structure If / elsif / else if ($thresh < 10) { # … the ‘then’ block of the conditional } elsif ($thresh < 20) { # the next block in the decision tree } elsif ($thresh < 40) { # and the next… } else { # the final clause catches what falls through } #!/usr/bin/perl # conditional.pl use strict; use warnings; my ($x, $y) = @ARGV; if ($x == $y) { print "equaln"; } else { print "not equaln"; } www.collaborationtech.co.in
  • 8. Functions and Subroutines func2.pl: firstSub(1, 2, 3, 4, 5, 6); firstSub(1..3); firstSub("A".."Z"); sub firstSub() { $numParameters = @_ ; print("The number of parameters is $numParametersn"); } func4.pl|: @array = (0..5); print("Before function call, array = @arrayn"); firstSub(@array); print("After function call, array = @arrayn"); sub firstSub{ $_[0] = "A"; $_[1] = "B";} This program prints: Before function call, array = 0 1 2 3 4 5 After function call, array = A B 2 3 4 5} www.collaborationtech.co.in
  • 9. Functions and Subroutines #!/usr/bin/perl # gc.pl use strict; use warnings; while (my $seq = <>) { chomp($seq); gc($seq); 8. } sub gc { my ($seq) = @_; $seq = uc($seq); # convert to upper case to be sure my $g = $seq =~ tr/G/G/; my $c = $seq =~ tr/C/C/; my $gc = ($g + $c) / length($seq); print "GC% = $gcn"; } }; www.collaborationtech.co.in
  • 10. Modules  A module is a package contained within an external file of the same name .pm extension file MyMod.pm: package MyMod; #no shebang!! use strict; use warnings; our ($foo, $bar, $baz); ($foo, $bar) = split /s+/, 'Hello World'; $baz = 42; 1; www.collaborationtech.co.in
  • 11. Packages #!/usr/bin/perl use warnings; #note no use strict! $foo = 'Hello'; #sets $main::foo package Bar; $foo = 'World'; #sets $Bar::foo package Lalli; print "$main::foo $Bar::foon"; prints "Hello Worldn" www.collaborationtech.co.in
  • 12. Follow us on Social Facebook: https://www.facebook.com/collaborationtechnologies/ Twitter : https://twitter.com/collaboration09 Google Plus : https://plus.google.com/100704494006819853579 LinkedIn : https://www.linkedin.com/in/ramananda-rao-a2012545 Instagram : https://instagram.com/collaborationtechnologies YouTube : https://www.youtube.com/channel/UCm9nK56LRbWSqcYWbzs8CUg Skype : facebook:ramananda.rao.7 WhatsApp : +91 9886272445 www.collaborationtech.co.in THANK YOU