You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
929 B
Perl

#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'