Multiple choice technology programming languages

Which of the following is not a legal scalar variable

  1. $Scalar
  2. $_Scalar
  3. $Scalar1
  4. $Sca_lar
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Perl, scalar variable names must start with \$ followed by a letter or underscore, then can contain letters, digits, and underscores. \$Scalar, $Scalar1, and $Sca_lar are all valid. $Scalar appears valid but is actually ILLEGAL because $ is a special variable (the default input/pattern-searching space) and cannot be used as a prefix for another variable name - you can't extend special punctuation variables.