- Perl was designed as a general purpose language.
- Variables do not need to be declared before assigning a value to them, but strict mode (highly recommended) requires this to avoid scope confusion.
- Variables use different sigils to indicate type: $ for scalars, @ for arrays, % for hashes.
- Curly braces surround code blocks.
- White space is largely irrelevant.
Basic Perl script
#!/usr/bin/perl use strict; sub cat { my ($hair, $name, $weight) = @_; my %cat = ( hair => $hair, name => $name, weight => $weight, ); return %cat; } sub purr { my ($cat, $volume) = @_; return $cat->{'weight'} * $volume; } my %kitty = cat('black', 'Spook', 3.2); print purr(\%kitty, 3);