Scalar variables (use my)



$this_is_a_long_scalar_variable
$ThisIsAlsoGoodButWeUseItLessInPerl
$h
$H             # $h and $H are two different variables


examples/scalars/scalar_variables.pl
#!/usr/bin/perl
use strict;
use warnings;

my $greeting   = "Hello world\n";
my $the_answer = 42;
my $name;                   # undef
print $greeting;
print $the_answer, "\n";

$name = 'Foo Bar';
print $name, "\n";

$the_answer = "Hi, you two";

The value can be changed any time.

Scalar variables