use v6; given $username { when 'root' { dostuff } when /^guest\d*$/ { die "You're not allowed to do stuff." } when any() { authenticate :web; dostuff } default { authenticate :local; dostuff } } #### use v6; dir '/some/directory', test => /\.txt$/; # a regex dir '/some/directory', test => none('.', '..'); # a junctionČ dir '/some/directory', test => &validate_filename; # a coderef