next up previous
Next: 2. Control constructs Up: 6. What Perl looks Previous: 6. What Perl looks

1. Data types

Perl has three main data types:

Here's how we initialise them:

my $name = "Fred";
my @pets = ("cat", "dog", "budgie");
my %pet_names = (
"cat"		=>	"Socks",
	"dog"		=>	"Fido",
	"budgie"	=>	"Tweetie"

The function my is used to declare variables when you're using the strict pragma to enforce declaration. This is optional, but recommended.

Kirrily Robert