my @array = (42,43,44,45);
my $scalar1 = 1;
my $scalar2 = 2;
($scalar1,$scalar2) = my_subroutine(@array,$scalar1, $scalar2);
print "$scalar1 $scalar2\n";
sub my_subroutine() {
my @a = @{shift()};
my $s1 = shift();
my $s2 = shift();
print "array: @a\ns1: $s1\ns2: $s2\n";
$s1 += 22;
$s2 += 33;
return ($s1, $s2);
}
####
main::my_subroutine() called too early to check prototype at - line 5.
Can't use string ("42") as an ARRAY ref while "strict refs" in use at - line 9.
##
##
sub my_subroutine(\@$$) {
my @a = @{shift()};
my $s1 = shift();
my $s2 = shift();
print "array: @a\ns1: $s1\ns2: $s2\n";
$s1 += 22;
$s2 += 33;
return ($s1, $s2);
}
my @array = (42,43,44,45);
my $scalar1 = 1;
my $scalar2 = 2;
($scalar1,$scalar2) = my_subroutine(@array,$scalar1, $scalar2);
print "$scalar1 $scalar2\n";