Lesson 02 of 55
8 mins readPython Syntax Rules, Comments & Strict Pragmas
In Plain English
Robust Perl programs always begin with `use strict;` and `use warnings;` to catch undeclared variables, typos, and runtime ambiguities before execution.
Deep Dive: How It Works
use strict: Enforces variable declarations with `my`, forbids symbolic references, and prevents barewords.
use warnings: Emits compile-time and runtime diagnostics for suspicious code patterns.
Single-Line Comments: Prefix comments with `#`.
POD (Plain Old Documentation): Embedded docs between `=head1` / `=cut` tags.
Core Rules to Remember

Strict & Warnings: Always include `use strict;` and `use warnings;` at the top of every Perl script.

Semicolon Termination: Every statement must end with a semicolon `;`.
Live Interactive Example
Hit Run Code to see it liveEnforcing Safety with Pragmas
Python 3.12
1
2
3
4
5
6
7
8
9
Output Console
Click "Run Code" to view the rendered output.
How it works: The variable names are interpolated directly inside double quotes.
Your Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Micro Exercise
Declare Lexical Variable
Declare a lexical variable `my $status = "Ready";`
Print `"System status: $status\n"`.
1
2
3
4
5
Sandbox Output
Click "Run & Check" to test your solution.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.