
Install perl on your system, Windows via activestate, or Unix via pearl.org, verify the version with perl -v, then write and run a hello world program using print in training.pl.
Explore Perl basics, including case sensitivity, scalar and list variables, and hashes. Learn to declare with semicolons, print lists and elements by index, and extend arrays at runtime.
Use the range operator double dot to copy a subarray into a new array; for example, extract elements 2 to 4 from list into my_team, then print the results.
Discover how to count array elements in Perl using the scalar operator and the $hash list, and introduce an input hash with key-value pairs accessed by keys.
This lecture demonstrates three Perl hash creation methods: array-style key-value pairs, the fat arrow operator, and dynamic dollar-hash notation, with examples printing keys like first name and age.
Learn how to create and access Perl hash variables, print values by key, and retrieve keys and values using hash functions, with on-the-fly hash creation and practical examples.
Copy hash values into an array and print them, then add and delete hash elements while printing updated keys. Explore Perl condition statements using if, else if, else, and unless.
Explore how Perl loops enable iterating through arrays and variables, including while, until, for loop, for each loop, do while, and nested loops, with initialization, test, body, and stepping.
Explore Perl loops, from while loops to for loops and for each, with practical examples that show initialization, test conditions, steps, and printing values.
The for each loop iterates a list in order using $_; the range operator can create 1 to 9 to sum values, and do while tests at the end.
Explore Perl loop controls such as next, last, continue, redo, and goto across while and for loops, with practical examples and cautions about using labels.
Explore practical Perl loop controls, including for each, next and last, to filter even and odd elements, accumulate sums, and control flow with continue blocks.
Demonstrate how the continue block in Perl loops runs regardless of the next statement, printing each element while summing only odd numbers and skipping even ones.
Explore the continue block for selective printing while the body computes sums, then use redo to re-run the loop when sum equals four to add three.
Explore how the Perl redo statement restarts the current loop iteration from the top until the sum reaches ten, then proceeds to subsequent elements.
Explore Perl control flow with goto and a named label that exits a loop when the sum exceeds 30 and arithmetic operators including exponential ** and x += 5.
Learn perl relational operators to test numeric and string conditions; numeric uses ==, !=, <, >, <=, >=, while strings use equal to, not equal to, less than, greater than.
Learn how perl handles comparisons using eq for strings and the == operator, and how the cmp operator yields minus one, zero, or plus one for numeric and string comparisons.
Explore Perl logical operators for numeric and string contexts, including and, or, and not, with examples of concatenation, repetition, range, increment, decrement, and the arrow operator for hashes and objects.
Define and call Perl subroutines using the sub keyword, return values, and optional ampersand syntax; use shift and the special variable $_ with foreach to sum all arguments.
Explore global and local variables in Perl, using the my keyword to define scope, and see how subroutines access and modify scalar and array data.
Master Perl variable scope, comparing my local versus global variables across subroutines and loops, then learn to create and dereference scalar, array, hash, and code references.
Create and dereference scalar, array, and hash references in Perl, print dereferenced values, and pass array and hash references to subroutines using the shift operator.
Explore how square brackets yield array references, curly braces yield hash references, and parentheses determine element or reference context, plus creating a subroutine that returns a code reference.
Master Perl file handling by dereferencing arrays and hashes, accessing elements, and using open to read, write, or append with standard file handles (stdin, stdout, stderr).
Open and write to data.txt, then read with the diamond operator and file handles. Compare overwriting versus appending when writing to data two.txt, and explore standard input/output in Perl.
Explore Perl file IO by opening, reading, writing, and appending with file handles, and learn why closing handles matters; compare scalar and array contexts for reading whole files versus lines.
Learn Perl file IO fundamentals: reuse and close file handles, handle open errors with die or warn, and manage Windows and Unix paths with proper escaping and $! error details.
Learn how to test files in Unix using options like -r, -b, -d, -e, -f, -m, -s, -n, -T, -w, and -z to verify readability, existence, type, size, and emptiness.
Explore perl directory and file operations, including open dir, read dir, close dir, mkdir, rmdir, chmod, and chown, then master string functions like length, lc, uc, index, and rindex.
Explore perl string functions, including length, upper, lower, index, and reverse index, and learn how -1 signals not found across multiple syntax options.
Learn to use printf for formatted printing in Perl, with format specifiers for decimals, strings, and characters, and explore push and pop for array-based stacks.
Demonstrate push and pop operations on arrays used as stacks, where the last inserted element is popped first, and reveal how shift and unshift affect the left end of list.
Master the shift and unshift operators in Perl, using them on the left side of an array to remove or add elements, contrasting with push and pop on the right.
Sort hashes in perl by keys or values using the spaceship operator, and split strings into arrays with flexible delimiters and default whitespace.
Learn Perl string manipulation with split and join for delimiter handling, then use the grip function to extract pattern matches and explore array intersections.
Build a hash from an array using for each, then apply grep on the temp hash to identify common elements with a second array. Use negation to reveal the differences.
Explore the map function in Perl to transform each array element into squares or cubes, and examine regular expressions and the infix operator for matching and non-matching.
Mastering Perl regex part 2 shows how to substitute patterns with the s operator, store regex in variables using qr and q, and reuse via pair delimiters across complex matches.
Explore how to use paired delimiters in regular expressions, including alternative delimiters and file-based pattern matching, with examples of replace, print if pattern, and case sensitivity.
Master regex by examining quantifiers, anchors, and alternation in Perl. Explore exact repetitions, optional matches, and escaping to build powerful search patterns.
Master escaping and delimiting in regular expressions, and anchoring with start and end of line. Use groups like ., \s, \d, \w, and Foo|Bar|Baz to match patterns.
Master regex patterns using backslash groups, digit and whitespace matching with \d and \s, dot-star, and square bracket character sets to match precise three-digit sequences.
Introduction
Dive into the world of Perl programming, a versatile and powerful language widely used for system administration, web development, and data manipulation. This course is designed to guide you from the basics of Perl to advanced concepts, equipping you with the skills needed to create efficient scripts and applications. Whether you're a beginner or seeking to enhance your coding expertise, this course offers a structured approach to mastering Perl.
Section-Wise Overview
Section 1: Introduction to Perl
Start your journey with an introduction to Perl programming. The opening lecture, "Hello World," walks students through setting up their environment and writing their first Perl script, laying a solid foundation for what's to come.
Section 2: Understanding Perl Variables
Learn the core building blocks of Perl scripts: variables. This section covers scalar, list, and hash variables, their creation, and operations like range and printing. By the end, students will understand how to manage and manipulate data structures efficiently in Perl.
Section 3: Perl Loops
Loops are essential for automation and iteration in programming. This section delves into while, for, and foreach loops, including practical control mechanisms. Multiple hands-on sessions ensure a thorough understanding of practical applications.
Section 4: Perl Operators
Explore Perl operators in depth, from arithmetic and relational operators to specialized commands like cmp and redo. This section sharpens your ability to perform complex operations in Perl scripts.
Section 5: Perl Subroutines and References
Master subroutines to streamline your code, learn about global variables, and dive into references and dereferencing. This section helps students write modular and reusable Perl scripts.
Section 6: File I/O and String Functions
Handle files and strings like a pro! This section covers file input/output operations in detail, including string manipulation functions like push, pop, shift, unshift, and powerful tools like split and grep.
Section 7: Mastering Perl Regular Expressions
The crown jewel of Perl! Gain expertise in regular expressions to search, manipulate, and validate data. This section progressively introduces regex, covering six comprehensive parts to make you a regex expert.
Conclusion
By the end of this course, students will have mastered Perl programming from its fundamentals to advanced techniques. Equipped with this knowledge, you can confidently tackle challenges in system administration, web development, and beyond.