- or download this
sub test_function {
my $ref = shift; # this function takes one argument, a ref to a
+n ARRAY
...
# Not necessarily recommended: shown for educational purposes.
defined($ref) or die "oops: you did not pass any arguments";
@_ and die "oops: this function takes exactly one argument";
- or download this
use strict;
use warnings;
...
test_function(undef);
};
say $@;
- or download this
X:\>perl foo.pl
Calling test_function with no arguments:
...
X:\>
- or download this
use strict;
use warnings;
...
test_function(undef);
};
say $@;
- or download this
X:\>perl foo.pl
Calling test_function with no arguments:
...
X:\>