Basic Perl Datatypes
#Scalars are always prefixed with $,
#arrays with an @, and
#hashes with a %.
If something is a variable, and it doesn't have a special character in front of it, it might be a filehandle.
Special Character What it Denotes Example
$ Scalar $number = 123.44; $string = 'aaaa';
@ Array @numberArray =(1,2,3);
@stringArray = ('elmt1', 'elmt2',3 );
$<var>[ ] Array Element print $stringArray[2];
$stringArray[4] = 'newstring';
% Hash %hashName = ('key' => 'value', 'key2'=>'value2');
$<var>{ } Hash Lookup print $hashName{'key'}; # prints 'value'
$hashName{'key3'} = 'value3'; # sets 'key3'
Related examples in the same category