=over =item when EXPR BLOCK X =item when BLOCK C is analogous to the C keyword in other languages. Used with a C loop or the experimental C block, C can be used in Perl to implement C/C like statements. Available as a statement after Perl 5.10 and as a statement modifier after 5.14. Here are three examples: use v5.10; foreach (@fruits) { when (/apples?/) { say "I like apples." } when (/oranges?/) { say "I don't like oranges." } default { say "I don't like anything" } } # require 5.14 for when as statement modifier use v5.14; foreach (@fruits) { say "I like apples." when /apples?/; say "I don't like oranges." when /oranges?; default { say "I don't like anything" } } use v5.10; given ($fruit) { when (/apples?/) { say "I like apples." } when (/oranges?/) { say "I don't like oranges." } default { say "I don't like anything" } } See L for detailed information. =back