The man page says
The "when" modifier is an experimental feature that first appeared in
Perl 5.14. To use it, you should include a "use v5.14" declaration.
However the man page contradicts itself, instead giving two examples
using v5.10.1, e.g.,
use v5.10.1;
for ($var) {
when (/^abc/) { $abc = 1 }
when (/^def/) { $def = 1 }
when (/^xyz/) { $xyz = 1 }
default { $nothing = 1 }
}
Also there is a space missing in "frequentlythe".