Passing Subroutine Arguments (Answer) | |
Practice Problems |
sub bozo {
my ($this, $that) = @_;
print "[$this] [$that]\n";
print "@_\n\n";
}
bozo "this", "that", "the other";
@dip = ("a", "b", "c");
bozo("A", @dip, "Z");
bozo "10";
bozo (("T"), ("h"), ("a", "t"));
[this] [that] this that the other [A] [a] A a b c Z [10] [] 10 [T] [h] T h a t
@_
.
The first two members of @_
wind up in $this
and
$that
. When only one argument is sent,
$that
is the empty string.
Patterns I | Question |