ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 5 PowerPoint PPT Presentation

presentation player overlay
1 / 13
About This Presentation
Transcript and Presenter's Notes

Title: ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 5


1
ECMM6018 Enterprise Networking For Electronic
CommerceTutorial 5
  • Server Side Scripting
  • Perl

2
What is it
  • Server Side Language
  • Cgi application resides in the /cgi-bin directory
  • ! /opt/bin/perl
  • Use CGI qw(standard)
  • ASP, JSP

3
Variable Types in Perl
  • Scalar variable Scalar variables used to
    contain strings, integer Numbers and floating
    point numbers (decimals) 
  • e.g. varname
  • Indexed array A variable that can store
    different scalar values,e.g. numbers, decimals
  • e.g. _at_arrayname
  • accessed arraynamei
  • Associative array elements of an associative
    array are referred to as "key" and "value" pairs
  • e.g. array
  • accessed arraykey pair
  • Variable names should be restricted to just
    letters of the alphabet, i.e. leave out
    characters such as !, _at_, , , , , , , (, ),

4
Mathematical Operators
  • Addition
  • - Subtraction
  • Multiplication
  • / Division
  • Adds one to the value on the left, i.e. j,
    jj1
  • -- Subtracts one from the value on the left j--,
    j j-1

5
Assignment Operators
  • Assigns what is on the right side to what is
    on the left e.g. a3
  •  
  • Adds the value of the right side to the left
    side and makes the variable on the left equal to
    it.
  • e.g. a 3, aa3
  •  
  • - Subtracts the value of the right side to the
    left side and makes the variable on the left
    equal to it.
  • e.g. a-3, aa-3

6
Comparison Operators
  • lt
  • gt
  • lt
  • gt
  • eq
  • !
  • Ne

7
Conditional Statement
  • If
  • If Else
  • If (condition)
  • statement
  • e.g. if (a!5)
  • print Answer is not 5\n

8
Conditional Statement
  • If-Else
  • If (condition)
  • statement
  • Else
  • statement
  • e.g. if (a!5)
  • print Answer is not 5\n
  • else
  • print Answer is 5\n

9
Conditional Statement
  • if (stuff lt 5)
  • print short!\n"
  • elsif (stuff gt 6)
  • print tall!\n"
  • else
  • print in between\n"

10
Looping
  • While
  • For
  • Foreach

11
While Statement
  • while (condition)
  • code to be executed
  • e.g. while (stuff lt6)
  • print stuff\n
  • stuff

12
For Statement
  • for (initialization test condition increment)
  • code to be executed
  • for (i 0 i lt stuff i)
  • print "stuffi"

13
For Each Statement
  • foreach slotspace (_at_stuff)
  • print "slotspace"
  • foreach slotname (keys (stuff))
  • print "stuffslotname"
Write a Comment
User Comments (0)
About PowerShow.com