Optional parameters are marked with a question mark after their names. The defined built-in function helps to tell if the parameter was really passed:
sub send-mail(Str $to, Str $bcc?) { Â Â Â if defined $bcc { Â Â Â Â Â Â Â # . . . Â Â Â Â Â Â Â say "Sent to $to with a bcc to $bcc."; Â Â Â } Â Â Â else { Â Â Â Â Â Â Â # . . . Â Â Â Â Â Â Â say "Sent to $to."; Â Â Â } } send-mail('mail@example.com'); send-mail('mail@example.com', 'copy@example.com');