For the following multi sub script:
multi sub Screen_get_valid_string($prompt, $accept_empty_string, $max_length = 999) { return "abc" }
multi sub Screen_get_valid_string($prompt, $max_length = 999) { return "def" }
my $return = Screen_get_valid_string("enter value for string => ", True);
say 'return is ', $return;
I receive the following error:
Ambiguous call to 'Screen_get_valid_string';
these signatures all match:
:($prompt, $accept_empty_string, $max_length = 999)
:($prompt, $max_length = 999)
The only way I found to have the right multi sub called was to use named parameters:
multi sub Screen_get_valid_string(:$prompt, :$accept_empty_string, :$max_length = 999) { return "abc" }
multi sub Screen_get_valid_string(:$prompt, :$max_length = 999) { return "def" }
my $return = Screen_get_valid_string(prompt => "enter value for string => ", accept_empty_string => True);
say 'return is ', $return;
The result is :
return is abc
Thank you
p.s. worked in Perl5; new to Perl6