Perl6 - PowerPoint PPT Presentation

About This Presentation
Title:

Perl6

Description:

Perl6 Michael Bryson Mark Staton Alex Varghese Overview Perl stands for practical extraction and report language Was written as a language to scan text files, extract ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 15
Provided by: stat116
Learn more at: https://www.cse.sc.edu
Category:
Tags: perl | perl6

less

Transcript and Presenter's Notes

Title: Perl6


1
Perl6
  • Michael Bryson
  • Mark Staton
  • Alex Varghese

2
Overview
  • Perl stands for practical extraction and report
    language
  • Was written as a language to scan text files,
    extract information from those files, and print
    reports based on that information

3
History
  • Perl1 was written around 1987.
  • Perl1 was mainly derived from C and to a lesser
    extent sed, awk, and the UNIX shell.
  • Perl1 was written for the file manipulation
    discussed earlier.

4
History (cont.)
  • Over the years, there have been many improvements
    in the language.
  • Perl now supports modularity and object-oriented
    programming.
  • Perl6 is the latest version and is a ground-up
    rewrite of the original source codes from
    versions 1 through 4.

5
History (cont.)
  • The evolution of Perl to the present day Perl6
    allows programmers to perform or use
  • Quick prototyping
  • System utilities
  • System management tasks
  • Database access
  • Graphical programming
  • Networking
  • World Wide Web programming

6
Interpreter/Compiler
  • Perl is an interpreted language. This allows
    one to write programs without an intermediate
    compilation step. Not having a compilation step
    allows a programmer to experiment and test/debug
    quickly. Perl has also become a great
    replacement for shell scripting.

7
Syntax
  • represents any scalar value
  • _at_ represents a list
  • represents a hash or associative array
  • You always need for any block in Perl. i.e.
    after an if statement
  • There are two sets of comparison operators. One
    set is for strings and the other is for numbers.

8
Parallel Data in Perl6
  • Junctions are a parallel scalar data-type, to be
    introduced in Perl 6
  • Four types of junctions
  • Disjunctions
  • Conjunctions
  • Abjunctions
  • Injunctions

9
Disjunctions (any)
  • anyvalue any(_at_list_of_values)
  • print A number is too large if anyvalue gt 10
  • can also be defined using binary operator ()
  • anyvalue first second
  • third
  • anyvalue fourth

10
Conjunctions (all)
  • allvalues all(_at_list_of_values)
  • print Must have positive number(s) if
    allvalues lt 0
  • can also be defined using binary operator ()
  • allvalues first second
  • third
  • allvalues fourth

11
Abjunctions (one)
  • onevalue one(_at_list_of_values)
  • print There is exactly one zero if onevalue
    0

12
Injunctions (none)
  • novalue none(_at_list_of_values)
  • print All negative numbers if novalue gt 0

13
More Junctions
  • Junctions can also be used implicitly
  • print all numbers must be positive if abc
    lt 0
  • Junctions are simply scalars
  • if (my_equals(value, any(_at_other_values)) ...
  • Can be used for type declarations
  • my CarTruck x
  • my CarRedObject y
  • my none(Truck) z
  • Allows for easy parallelization
  • if( sqrt( any(_at_some_numbers) ) gt 5 ) ...

14
Comparisons
  • Perls expression syntax corresponds closely to
    C.
  • If you have experience with C or using UNIX, it
    is relatively easy to learn Perl.
  • On the surface, Perl and TCL are very similar.
    However, it is not until one is writing more
    complex programs and code that the differences
    become apparent.
Write a Comment
User Comments (0)
About PowerShow.com