- or download this
$a=5;
$b="five";
$c=5.0
- or download this
$a="5.0"; # set up our variables
$b="5"; # # to the end of a line is a comment in perl
...
print "These variables are equal as strings\n" if($a eq $b);
print "These variables are equal numerically\n" if($a==$b);
- or download this
@a=(1,2,3);
@simpsonsfamily=("homer","marge","lisa","maggie","bart");
- or download this
push @array, $value; #puts $value onto the end of @array.
- or download this
@array=reverse @array;
- or download this
@array=("key1","value1","key2","value2"); #an array filled with key
+value pairs
%hash1=("key1"=>"value1","key2"=>"value2"); #one way to initialize a h
+ash (key=>value,key2=>value2,..)
%hash2=@array; #making %hash2 out of a co
+llection of key value pairs in an array
$hash3{"key1"}="value1"; #creates key of "key1" and
+ value of "value1"
$hash3{"key2"}="value2";