Presentation is loading. Please wait.

Presentation is loading. Please wait.

Perl6 Michael Bryson Mark Staton Alex Varghese. Overview  Perl stands for practical extraction and report language  Was written as a language to scan.

Similar presentations


Presentation on theme: "Perl6 Michael Bryson Mark Staton Alex Varghese. Overview  Perl stands for practical extraction and report language  Was written as a language to scan."— Presentation transcript:

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. 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  @ 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(@list_of_values); print “A number is too large” if $anyvalue > 10; can also be defined using binary operator (|) $anyvalue = $first | $second | $third; $third; $anyvalue |= $fourth;

10 Conjunctions (all) $allvalues = all(@list_of_values); print “Must have positive number(s)” if $allvalues < 0; can also be defined using binary operator (&) $allvalues = $first & $second & $third; $third; $allvalues &= $fourth;

11 Abjunctions (one) $onevalue = one(@list_of_values); print “There is exactly one zero” if $onevalue == 0;

12 Injunctions (none) $novalue = none(@list_of_values); print “All negative numbers” if $novalue > 0;

13 More Junctions   Junctions can also be used implicitly:   print “all numbers must be positive” if $a|$b|$c < 0;   Junctions are simply scalars:   if (my_equals($value, any(@other_values)) {... }   Can be used for type declarations:   my Car|Truck $x;   my Car&RedObject $y;   my none(Truck) $z;   Allows for easy parallelization   if( sqrt( any(@some_numbers) ) > 5 ) {... }

14 Comparisons  Perl’s 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.


Download ppt "Perl6 Michael Bryson Mark Staton Alex Varghese. Overview  Perl stands for practical extraction and report language  Was written as a language to scan."

Similar presentations


Ads by Google