my @arr = (1,2,3,4);
print "This is array: @niz\n";
my $ref = \@niz;
print "This is the reference: $ref\n";
print "And this should be dereferencing or getting the value of the array through the reference : @{$ref}\n"; # This is same as (print "This is array: @niz\n";)
####
my %h = ('Ivan'=>7,
'AK'=>8,);
print "$h{'Ivan'}\n";
my $refh = \%h;
print "$refh\n";
print "${$refh}{'Ivan'}\n";
print "$refh->{'Pero'}\n";
####
my $sales = {
monday => { jim => [ 2 ], mary => [ 1, 3, 7 ] },
tuesday => { jim => [ 3, 8 ], mary => [ 5, 5 ] },
wednesday => { jim => [ 7, 0 ], mary => [ 3 ] },
thursday => { jim => [ 4 ], mary => [ 5, 7, 2, 5, 2 ] },
friday => { jim => [ 1, 1, 5 ], mary => [ 2 ] },
};
my $commissions = $sales->{tuesday}{jim};
my $num_sales = @$commissions;
my $total = 0;
foreach (@$commissions) {
$total += $_;
}
print "Jim made $num_sales sales on Tuesday and earned \$$total commission\n";