Nov 23, 2006

Basic #5, Scalar variables

A variable is essentially a placeholder for some data, which can be reused many times.
For perl, we do not need to declare what type(int, string) is the variable.

variables in perl are just prefixed with a $
e.g.

$a = 'apple';
$number = 67;
$number = '67';
$number = '00067';

all of the above are valid assignments

variable names can be combinations of numbers, characters and _.

$_ is special and reserved, cannot be used.

Scalar variables are case sensitive, i.e. $a is different from $A.


No comments: