
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.
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 practical Perl loop controls, including for each, next and last, to filter even and odd elements, accumulate sums, and control flow with continue blocks.
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.
Learn perl relational operators to test numeric and string conditions; numeric uses ==, !=, <, >, <=, >=, while strings use equal to, not equal to, less than, greater than.
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.
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.
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 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.
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.
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.
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.