use warnings;
use strict;
use v5.10;
my $variable = 22;
my $pointer = \$variable;
say "The address of \$varible, which contains the value $variable,";
say "is $pointer";
$$pointer = 25;
say "Look at that! \$variable now equals $variable";
sub sum_and_diff {
my $a = shift @_;
my $b = shift @_;
my $res = \(shift @_); # why does the "\" work here?
my $sum = $a + $b;
$$res = $a - $b;
return $sum;
}
my $b = 2;
my $diff; # this is line 27
my $pointer_to_diff = \$diff;
say "the sum of 5 and $b is ", &sum_and_diff(5, $b, $pointer_to_diff);
say "and the difference is ", $pointer_to_diff;
say "the sum of 9 and $b is ", &sum_and_diff(9, $b, \$diff);
say "and the difference is ", $diff; # this is line 34