Perl: Variable Name Prefix (Sigil)
in Perl, every variable name must start with a special char, called sigil:
$
(DOLLAR SIGN) → means the VALUE of the variable is a “scalar”. i.e. string, number.@
(AT Sign) → means the VALUE of the variable is a array.%
(PERCENT SIGN) → means the VALUE of the variable is a hash table.
use Data::Dumper; # for printing array and hash $Data::Dumper::Indent = 0; # set to print compact # scalar $aa = 4; # array @aa = (1, 2, 3); # hash %aa = ('e' => 4, 'f' => 5, 'g' => 6); print $aa, "\n"; # 4 print Dumper(\@aa), "\n"; # $VAR1 = [1,2,3]; print Dumper(\%aa), "\n"; # $VAR1 = {'e' => 4,'g' => 6,'f' => 5};