#! /usr/bin/perl


### Scalars ###
$a = 4;
$b = 'A string';
$c = "Another string";

print $a, $b, $c, "\n";
$ans = <>;

print "$a $b $c\n";
$ans = <>;

print '$a $b $c\n';
$ans = <>;

$c = "How to mix ($b) thing's up a bit! " . $b . " \" ' \" ";

print "\n";
print "$c\n"; 
$ans = <>;


### Arrays ###
@arr = (1, 2, 'three', 55, 'Perl', -7);

print "First element: $arr[0], third element: $arr[2]\n"; 
$ans = <>;

print "@arr\n";
$ans = <>;

push @arr, (-1, -2, -3);
print "@arr\n";
$ans = <>;

$last_element = pop @arr;
print "Last element was: $last_element\n";
print "Is is now removed from the array: '@arr'\n";
$ans = <>;

$a = '1 2 3 4 5 6 7 8 9 10';
@parts = split ' ', $a;
print $parts[2] * $parts[9], "\n";
$ans = <>;

$b = join '<->', @parts;
print "$b\n";
$ans = <>;

$len = @arr;
$last_index = $#arr;
print "Length is: $len, last index is $last_index\n";
$ans = <>;


### Hashes ###
%h1 = ('key1', 'val1', 'key2', 'val2');
%h2 = ('key1' => 'val1', 'key2' => 'val2');
print "%h1\n";
print %h2,"\n";
$ans = <>;

print "'key1' has the value: $h1{'key1'}\n";
$ans = <>;

@allkeys = keys %h1;
@allvalues = values %h1;
print "@allkeys\n";
print "@allvalues\n";
$ans = <>;

@arr = %h1;
print "@arr\n";
$ans = <>;

delete $h1{'key1'};
print %h1, "\n";

