The most basic kind of variable in Perl is the scalar variable. Scalar variables hold both strings and numbers, and are remarkable in that strings and numbers are completely interchangable. We have seen basic assignment of scalar (single data element) variables already: $myVar = 'c'; # Character $myVar = "Hello World!"; # String $myVar = 42; # Integer $myVar = 3.14159; # Float
$myVar = 'c'; # Character $myVar = "Hello World!"; # String $myVar = 42; # Integer $myVar = 3.14159; # Float