in reply to Re: Assigning default values to function arguments which may be “empty”
in thread Assigning default values to function arguments which may be “empty”

That doesn't cover his case for the empty string to also be defaulted; so:

sub f { my $arg = defined $_[0] && length $_[0] ? shift : 'default'; }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^2: Assigning default values to function arguments which may be �empty�
  • Download Code

Replies are listed 'Best First'.
Re^3: Assigning default values to function arguments which may be �empty�
by Wyrdweaver (Beadle) on Aug 18, 2016 at 05:07 UTC

    I'm experimenting with some variations based on ideas here and elsewhere (BTW, thanks for being so much friendlier than codereview.stackexchange.com! OMG, they are tightly wound).

    Thanks, again!
Re^3: Assigning default values to function arguments which may be �empty�
by stevieb (Canon) on Aug 17, 2016 at 20:16 UTC

    d'oh! Yeah, I completely missed the whole empty thing.