in reply to functional "given...when..."?

Just for kicks you could write

my $suffix = sub { given ($type) { when ("csv") { return "txt" } when ("xml") { return "xml" } }}->();

(in which case you can't use continue, of course)