given is analogous to theswitch keyword in other languages.given andwhen are used in Perl to implementswitch/case like statements. Only available after Perl 5.10. For example:
use v5.10;given ($fruit) { when (/apples?/) { print "I like apples." } when (/oranges?/) { print "I don't like oranges." } default { print "I don't like anything" }}See"Switch statements" in perlsyn for detailed information.
Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.
The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.