#!/usr/bin/env perl use strict; use warnings; use feature qw(signatures); no warnings qw(experimental::signatures); use Test::More tests => 8; sub baz($this, $that) { ok defined($this), "\$this is defined and contains $this"; ok defined($that), "\$that is defined and contains $that"; is scalar(@_), 2, '@_ has two elements.'; is_deeply \@_, [$this, $that] or diag 'Parameters: ', explain { this => $this, that => $that, at_underscore => \@_ }; } sub foo ($this, $that='bar') { ok defined($this), "\$this is defined and contains $this"; is $that, 'bar', '\$that contains "bar"'; is scalar(@_), 2, '@_ has two elements.'; is_deeply \@_, [$this, $that] or diag 'Parameters: ', explain { this => $this, that => $that, at_underscore => \@_ }; } note "\n\nTesting baz()"; baz('hello', 'world'); note "\n\nTesting foo()"; foo("a");