- Variables are a letter, followed by zero or more letters, digits or
- All characters are significant
- Sign defines type of variable:
- Strings inside of doublequotes are expanded out
print "There were $nmatches matches
is the same as
print "There were ", $nmatches, " matches found.";
- Quoting the dollar sign removes significance:
my $n=5; print "The value of \$n is $n";
The value of
$n is 5
- By default, variables are global.
- local $var hides
& saves a copy of $var for the duration of the block.
- my $var is probably
what you want for "local variables" as we understand them from C and