develooper Front page | perl.perl5.porters | Postings from January 2022

Re: Things you can't do in a signatured sub

Thread Previous | Thread Next
Ovid via perl5-porters
January 21, 2022 17:03
Re: Things you can't do in a signatured sub
Message ID:
On Friday, 21 January 2022, 17:49:47 CET, Ovid via perl5-porters <> wrote:

> I knew my 3VL discussion went over like a lead balloon, but I couldn't resist being cheeky ...
>   use Unknown::Values;
>   sub foo ($bar = unknown) {
>        say is_unknown $bar ? "unknown" : "known";
>    }
>   foo();
> That prints "unknown", so if someone passed in `undef`, it will print "known" because
> someone explicitly assigned to it.

Er ... because someone "didn't" explicitly assign to it. (Damned typos (sic))

IT consulting, training, specializing in Perl, databases, and agile development 

Buy my book! -

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About