Table of Contents
#A comment start with a '#' and finish at the end of the line. $foo = 3; #An instruction is always ended by a ';'. $foo=3; #Spaces, tabs, line breaks, etc does not matter in Perl's syntax. print($foo); #Will print 3 on the standard output. print $foo; #Will do the same. Functions can be called with or without parentheses.
In Perl, each operation is evaluated in a specific context, which can be:
- List: For arrays and hash-tables.
- Scalar: Which can be:
- String: Scalars are considered as string.
- Numerical: Scalars are considered as numbers.
- Tolerant: Generic scalar context.
- Void: When the expression value is ignored.
Functions and operators can return different results depending on their call context.
#To put at the top of the code. use strict; #Make the language less permissive. use warnings; #Interpreter will display useful warning messages.
Perl generalities > (Next Chapter) Scalars in Perl