Program to illustrate the use of scalar variables.
#!perl
$a = 5;
print "The value of variable a is: $a\n";
$a = $a + 5;
print "Variable a after adding 5 is: $a\n";
$a *= 2;
print "Variable a after multiplying by 2 is: $a\n";
# using an uninitialized variable in the context of a string
print "Using a variable before initializing: $var\n";
# using an uninitialized variable in a numeric context
$test = $num + 5;
print "Adding uninitialized variable \$num to 5 yields: $test.\n";
# using strings in numeric contexts
$str = "A string value";
$a = $a + $str;
print "Adding a string to an integer yields: $a\n";
$strnum = "15charactersand1";
$c = $a + $strnum;
print "Adding $a to string \"$strnum\" yields: $c\n";