- 1. Perl
- 2. Preface
- 2.1. Content
- 3. Introdcution
- 3.1. Installation
- 3.2. Editors
- 3.3. IDEs
- 3.4. Perl on the command line
- 3.5. First script
- 3.6. Safety net
- 3.7. First sub
- 3.8. First say
- 3.9. print vs. say
- 3.10. Debugging
- 3.11. Avoid global variables
- 3.12. Keep it Simple - KISS
- 3.13. Comments
- 3.14. Perl documentation
- 3.15. POD - Plain Old Documentation
- 3.16. Exercise: Hello world
- 4. Scalars
- 4.1. Scalars intro
- 4.2. Scalar values
- 4.3. undef
- 4.4. Numbers - integers, real or floating-point
- 4.5. Strings
- 4.6. Scalar variables (use my)
- 4.7. Sigils and variables
- 4.8. Common error messages
- 4.9. Greeting with a name, Variable interpolation
- 4.10. User Input
- 4.11. chomp
- 4.12. Numerical Operators
- 4.13. Autoincrement
- 4.14. String Operators
- 4.15. String - Number conversion
- 4.16. Conditional statements: if
- 4.17. Syntax of if statement
- 4.18. Comparison operators
- 4.19. Compare values - examples
- 4.20. undef, the initial value and defined
- 4.21. Boolean expressions (logical operators)
- 4.22. Boolean values: TRUE and FALSE
- 4.23. Your Salary is in Danger - Short-Circuit
- 4.24. Exercise: Rectangular
- 4.25. Exercise: Rectangular prompt
- 4.26. Exercise: Rectangular warn
- 4.27. Exercise: Concatenation
- 4.28. Exercises: Simple Calculator
- 4.29. Solution: Rectangular
- 4.30. Solution: Rectangular prompt
- 4.31. Solution: Rectangular warn
- 4.32. Solution: Concatenation
- 4.33. Solution: Simple Calculator
- 4.34. Solution: Simple Calculator (using eval)
- 4.35. String functions (length, lc, uc, index)
- 4.36. String functions (index, rindex)
- 4.37. String functions (substr)
- 4.38. Strings - Double quoted
- 4.39. Strings - Single quoted
- 4.40. Scope of variables
- 4.41. Scope of variables - 2
- 4.42. Scope of variables - 3
- 4.43. Scope of variables - 4
- 4.44. Scope of variables - 5
- 4.45. Random numbers
- 4.46. Here documents - double quotes
- 4.47. Here documents - single quotes
- 4.48. Exercise: Number Guessing game
- 4.49. Solution: Number Guessing game
- 5. Files
- 5.1. die, warn, exit
- 5.2. while loop
- 5.3. Loop controls: next, last
- 5.4. Opening file for reading
- 5.5. Opening a file
- 5.6. Opening a file - error handling
- 5.7. Opening a missing file
- 5.8. Read one line from a file
- 5.9. Process an entire file line by line (while, cat)
- 5.10. Write to a file
- 5.11. Sum of numbers in a file
- 5.12. Analyze the Apache log file
- 5.13. Encoding and UTF-8
- 5.14. Open files in the old way
- 5.15. Binary mode
- 5.16. Reading from file, read, eof
- 5.17. tell, seek
- 5.18. truncate
- 5.19. Exercise: Add more statistics
- 5.20. Exercise: Write report to file
- 5.21. Exercise: Analyze Apache - number of successful hits
- 5.22. Solution: Add more statistics
- 5.23. Solution: Write report to file
- 5.24. Solution: Analyze Apache - number of successful hits
- 6. Lists and Arrays
- 6.1. Lists and Arrays intro
- 6.2. List Literals, list ranges
- 6.3. List Assignment
- 6.4. loop over elements of list with foreach
- 6.5. Create an Array, loop over with foreach
- 6.6. Array Assignment
- 6.7. Debugging an array
- 6.8. foreach loop on numbers
- 6.9. Array index (menu)
- 6.10. Load Module
- 6.11. Command line parameters
- 6.12. Process command line parameters, use modules
- 6.13. Module documentation
- 6.14. process CSV file
- 6.15. process csv file (short version)
- 6.16. One-liner sum numbers in CSV file
- 6.17. process csv file using Text::CSV
- 6.18. process csv file using Text::CSV
- 6.19. Join
- 6.20. Labels
- 6.21. Exercise: Make the color selector user friendly
- 6.22. Exercise: improve the color selector
- 6.23. Exercise: Improve the Number Guessing game
- 6.24. Solution: improved color selector
- 6.25. Solution: Improve the Number Guessing game
- 7. Advanced Arrays
- 7.1. The year 19100
- 7.2. SCALAR and LIST Context
- 7.3. Context Sensitivity
- 7.4. Filehandle in scalar and list context
- 7.5. slurp mode
- 7.6. File::Slurp
- 7.7. Diamond operator
- 7.8. pop, push
- 7.9. push example
- 7.10. stack (pop, push) Reverse Polish Calculator
- 7.11. shift, unshift
- 7.12. queue (shift, push)
- 7.13. shift
- 7.14. reverse
- 7.15. Sort
- 7.16. Ternary operator
- 7.17. Count digits
- 7.18. Exercise: Color selector
- 7.19. Exercise: sort numbers
- 7.20. Exercise: sort mixed string
- 7.21. Exercise: sort mixed string 2
- 7.22. Solution: color selector files
- 7.23. Solution: sort numbers
- 7.24. Solution: sort mixed strings
- 7.25. Solution: sort mixed strings
- 7.26. List::Util
- 7.27. Advanced: Multi dimensional array
- 8. Functions and Subroutines
- 8.1. Why to use subroutines?
- 8.2. Subroutines
- 8.3. Variable number of parameters
- 8.4. Recursive subroutines: factorial
- 8.5. Recursive subroutines: Fibonacci
- 8.6. Sort using a function
- 8.7. Return a list
- 8.8. Return several elements
- 8.9. Error handling with eval - files
- 8.10. Error handling with eval - two calls
- 8.11. Exercise: Subroutines
- 8.12. Exercise: Number guessing in sub
- 8.13. Solution: Number guessing in sub
- 9. Hashes
- 9.1. What is a hash?
- 9.2. Uses of hashes
- 9.3. Creating hashes
- 9.4. Create hash from an array
- 9.5. Hash in scalar context
- 9.6. Fetching data from hash
- 9.7. exists, delete hash element
- 9.8. Multi dimensional hashes
- 9.9. Count words
- 9.10. Exercise: Parse HTTP values
- 9.11. Exercise: Improve the color selector
- 9.12. Exercise: Display scores
- 9.13. Exercise: Analyze Apache log file
- 9.14. Exercise: Parse variable width fields
- 9.15. Solution: Parse HTTP values
- 9.16. Solution: Improve the color selector
- 9.17. Solution: Display scores
- 9.18. Solution: Analyze Apache log file
- 9.19. Solution: Parse variable width fields
- 10. Shell to Perl
- 10.1. Shell and Perl intro
- 10.2. File test or -X operators
- 10.3. Running External Programs
- 10.4. Open pipe for reading
- 10.5. Open pipe for writing
- 10.6. Pager
- 10.7. sendmail.pl
- 10.8. UNIX commands from the inside
- 10.9. File globbing (wildcards)
- 10.10. Rename files
- 10.11. Directory handles
- 10.12. File::HomeDir
- 10.13. More UNIX commands implemented in modules
- 10.14. File::Spec
- 10.15. Change Copyright text in every source file in a directory hierarchy
- 10.16. Exercise: Tree
- 10.17. Exercise: Check for UID 0
- 10.18. Exercise: CPU load
- 10.19. Exercise: MANIFEST file
- 10.20. Solutions: Tree
- 10.21. Solutions: Check for UID 0
- 10.22. Solution: CPU load
- 10.23. Solution: MANIFEST file
- 11. Using Perl modules, using CPAN
- 11.1. Using modules exporting functions
- 11.2. Using Object Oriented modules
- 11.3. Selecting Module to use
- 11.4. Some interesting CPAN Modules: DateTime
- 11.5. Days passed
- 11.6. Some interesting CPAN Modules: Databases
- 11.7. Some interesting CPAN Modules: Web
- 11.8. Some interesting CPAN Modules: common file format
- 11.9. Some interesting CPAN Modules
- 11.10. Installing modules
- 11.11. Installing modules from the os vendor
- 11.12. Using CPAN.pm
- 11.13. Configure CPAN.pm
- 11.14. Installing modules manually
- 11.15. Installing modules manually using Build.PL
- 11.16. On Windows
- 11.17. Changing @INC
- 11.18. Changing @INC - Relative PATH
- 11.19. local::lib
- 11.20. CPAN.pm
- 11.21. Installing modules on ActivePerl
- 11.22. CPAN::Reporter
- 11.23. Exercise: setup local::lib
- 11.24. Exercise: Module installation
- 11.25. Exercise: Read Excel file
- 11.26. Solution: Module installation
- 11.27. Solution: Read Excel file
- 12. Applications
- 12.1. Simple uses of Perl
- 12.2. Create Unix user account
- 12.3. Reporting file system diskspace usage (df)
- 12.4. Reporting diskspace usage on the mail server
- 12.5. A du like script
- 12.6. Send files by e-mail
- 12.7. Read Excel file
- 12.8. Process file with fixed width records
- 12.9. Process file with multiline records
- 12.10. Process multi field csv file
- 12.11. Fetch web page
- 12.12. Generate web page
- 12.13. Parse XML file
- 12.14. Database access using DBI and DBD::SQLite
- 12.15. Net::LDAP
- 12.16. Tie::File
- 13. Extra slides
- 13.1. List all defined variables
- 13.2. Perl internal variables
- 13.3. What is Perl ?
- 13.4. What does Perl stand for ?
- 13.5. Scripting language ?
- 13.6. Is Perl Interpreted or Compiled Language
- 13.7. Why use Perl ?
- 13.8. What is it good for ?
- 13.9. Its strengths
- 13.10. Redirection by the user
- 13.11. for loop
- 13.12. ASCII table
- 13.13. default variable $_
- 13.14. Return values
- 13.15. UNIX file system, hard links symbolic links
- 13.16. stat, lstat
- 13.17. Compare values
- 13.18. Bitwise Operations
- 13.19. bitwise examples
- 13.20. Filename creation based on date
- 13.21. Debugging prints
- 13.22. Where is perl installed on your system ?
- 13.23. Send e-mail
- 14. XML using Perl
- 14.1. XML sample data
- 14.2. XML Definitions
- 14.3. XML processing modes
- 14.4. XML::Simple
- 14.5. XML::Simple dumped
- 14.6. XML::Simple processing
- 14.7. XML::Parser
- 14.8. XML::Parser tree
- 14.9. XML::Parser tree results
- 14.10. XML::Parser
- 14.11. XML::LibXML
- 14.12. XML::XPath
- 14.13. XML::Twig
- 14.14. XML::Writer
- 14.15. XML::Dumper
- 14.16. Exercise: parse glade.xml
- 14.17. DTD validation
- 14.18. Specialized XML modules
- 14.19. Resources
- 15. Parsing HTML File
- 15.1. HTML::Parser - fetch title
- 15.2. HTML::Parser
- 15.3. HTML::Encode
- 15.4. Autoclose
- 16. Appendix
- 16.1. Resources, How to get support for Perl ?
- 16.2. Recommended Books
- 17. More about files
- 17.1. Exercise: Create a counter
- 17.2. Exercise: Create multiple counters
- 17.3. Exercises: List old logfiles
- 17.4. Solution: Create a counter
- 17.5. Solution: Create multiple counters
- 17.6. Solutions: List old logfiles
- 18. Testing Demo for Perl
- 18.1. Testing Demo AUT
- 18.2. Testing Demo using Test::More (success)
- 18.3. Testing Demo using Test::More (failure)
- 18.4. Testing Demo - Test coverage report
- 19. File processing
- 19.1. Filehandle in scalar and list context
- 19.2. slurp mode
- 19.3. Diamond operator
- 19.4. File::Slurp
- 20. Other
- 20.1. Read CSV file as array of hashes
- 20.2. Sort array using sort and sort_by
- 20.3. Range iterator
- 20.4. Benchmark
- 20.5. Bubble sort
- 20.6. Insert sort
- 20.7. Merge sort
- 20.8. Quicksort
- 20.9. Timsort
- 20.10. Traverse directory tree
- 20.11. Traverse directory tree with call back
- 20.12. Linear search in unorderd array
- 20.13. Binary search in sorted array
- 20.14. Convert curl command with -F to LWP::UserAgent
- 20.15. Modify time anomality in two files