🐪 Perl Scalars

Scalars in Perl are variables that hold a single value: a string, number, or reference. They start with a $ symbol.

🖥️ Example 1: Declaring Scalars

Use my to declare scalars locally.

Output will appear here...

🖥️ Example 2: String Interpolation

Double quotes allow variable interpolation, while single quotes print literals.

Output will appear here...

🖥️ Example 3: Math with Scalars

Perl can perform arithmetic operations on numeric scalars.

Output will appear here...
💡 Tip: In Perl, scalars are prefixed with $ whether holding numbers, strings, or references.