Introduction to Perl6

Gabor Szabo


Table of Contents
1. Introduction to Perl6
1.1. Disclaimer
1.2. More disclaimer
1.3. Getting started
1.4. Installing Pugs on Linux
1.5. Building Pugs on Ubuntu
1.6. Development Environment
1.7. Running Pugs
1.8. Hello World
1.9. Comments
1.10. POD - Plain Old Documentation
2. First steps in Perl6
2.1. Hello World - scalar variables
2.2. Hello World - interpolation
2.3. Reading from the keyboard
2.4. Numerical operations
2.5. Add
2.6. Division
2.7. String operators
2.8. if statement - comparing values
2.9. Comparison Operators
2.10. Boolean expressions (logical operators)
2.11. Chained comparisons
2.12. Comparing values - Calculator
2.13. Calculator - given
2.14. String functions: index
2.15. String functions: substr
2.16. Super-or (junctions)
3. Files in Perl6
3.1. exit, warn, die
3.2. Read line from file
3.3. Process a file line by line
3.4. Write to a file
3.5. Open file modes
3.6. Exercise: Print sum of numbers
3.7. Solution
3.8. undef, defined, not
4. Perl6 Lists and Arrays
4.1. List Literals, list ranges
4.2. List Assignment
4.3. Swap two values
4.4. loop over elements of list with for
4.5. Create array, go over elements
4.6. Array elements (create menu)
4.7. Array assignment
4.8. Command line options
4.9. Process CSV file
4.10. join
4.11. Hyper Operators
4.12. slurp
4.13. xx - string multiplicator
5. Perl6 Hashes
5.1. Associative Arrays (Hashes)
5.2. Fetching data from a hash
5.3. Multidimensional hashes
5.4. Count words
5.5. Overview
5.6. slurp
6. Subroutines in Perl6
6.1. Subroutines
6.2. Subroutines
6.3. Subroutines
6.4. Subroutines
6.5. Subroutines
7. Junctions in Perl6
7.1. Junctions
7.2. More examples with Junctions
8. Perl5 to Perl6
8.1. Intro
8.2. Hello World
8.3. Scalars
8.4. Arrays
8.5. Hashes
8.6. Control Structures
8.7. Functions
8.8. Files
8.9. Modules, Classes
9. Shell to Perl6
9.1. Intro
9.2. Unix commands in Perl6
9.3. awk
9.4. cat
9.5. cd in Perl6
9.6. chmod
9.7. chown
9.8. cmp
9.9. compress
9.10. cut
9.11. date
9.12. diff
9.13. df
9.14. dos2unix
9.15. du
9.16. file
9.17. find
9.18. grep
9.19. gzip
9.20. head
9.21. kill
9.22. ln
9.23. ls
9.24. mkdir
9.25. mv
9.26. ps
9.27. popd
9.28. pushd
9.29. pwd
9.30. rmdir
9.31. rm
9.32. sed
9.33. sort
9.34. tail
9.35. tar
9.36. touch
9.37. uniq
9.38. unix2dos
9.39. wc
9.40. who
9.41. zip
9.42. Other UNIX command
Table of Contents
List of Tables
2-1. Comparison Operators
2-2. Logical operators
List of Examples
1-1. examples/intro/hello_world.p6
1-2. examples/intro/hello_world_oop.p6
1-3. examples/intro/comments.p6
1-4. examples/intro/documentation.p6
2-1. examples/scalars/hello_world_variable.p6
2-2. examples/scalars/hello_world_variable_interpolation.p6
2-3. examples/scalars/read_stdin.p6
2-4. examples/scalars/numerical_operators.p6
2-5. examples/scalars/add.p6
2-6. examples/scalars/divide.p6
2-7. examples/scalars/string_operators.p6
2-8. examples/scalars/concat.p6
2-9. examples/scalars/if.p6
2-10. examples/scalars/comparison_operators.p6
2-11. examples/scalars/logical_operators.p6
2-12. examples/scalars/chained_comparison.p6
2-13. examples/scalars/calculator.p6
2-14. examples/scalars/calculator_given.p6
2-15. examples/scalars/string_functions_index.p6
2-16. examples/scalars/string_functions_substr.p6
2-17. examples/scalars/junctions.p6
3-1. examples/files/exit.p6
3-2. examples/files/warn_die.p6
3-3. examples/files/read_one_line.p6
3-4. examples/files/read_file.p6
3-5. examples/files/write_file.p6
3-6. examples/files/statistics.p6
4-1. examples/arrays/list_literals.p6
4-2. examples/arrays/lists.p6
4-3. examples/arrays/arrays.p6
4-4. examples/arrays/list_colors_array.p6
4-5. examples/arrays/color_menu.p6
4-6. examples/arrays/array_assignment.p6
4-7. examples/arrays/color_menu_option.p6
4-8. examples/arrays/process_csv_file.csv
4-9. examples/arrays/process_csv_file.p6
4-10. examples/arrays/join.p6
4-11. examples/arrays/hyper.p6
4-12. examples/files/slurp_file.p6
4-13. examples/arrays/xx.p6
5-1. examples/hash/create_hash.p6
5-2. examples/hash/print_hash.p6
5-3. examples/hash/count_words.p6
5-4. examples/hash/hash.p6
5-5. examples/files/slurp_csv_file.p6
5-6. examples/files/phonebook.txt
6-1. examples/subroutines/named_definitions.p6
6-2. examples/subroutines/optional_params.p6
6-3. examples/subroutines/definitions.p6
6-4. examples/subroutines/fibonacci.p6
6-5. examples/subroutines/multiple_same_name_params.p6
7-1. examples/junctions/intro.p6
7-2. examples/junctions/operators.p6
7-3. examples/junctions/substr.p6
7-4. examples/junctions/j.p6
7-5. examples/junctions/x.p6
7-6. examples/junctions/any.p6
8-1. examples/p526/hello_world.p6
8-2. examples/p526/scalars.p6
8-3. examples/p526/arrays.p6
8-4. examples/p526/hashes.p6
8-5. examples/p526/control_structures.p6
8-6. examples/p526/functions.p6
8-7. examples/p526/files.p6
8-8. examples/p526/modules.p6