Perl version

Modules

  • ABCDE
  • FGHIL
  • MNOPS
  • TUX

given

Perl 5 version 14.2 documentation
Recently read

given

  • given EXPR BLOCK

  • given BLOCK

    given is analogous to the switch keyword in other languages. given and when are used in Perl to implement switch /case like statements. Only available after Perl 5.10. For example:

    1. use v5.10;
    2. given ($fruit) {
    3. when (/apples?/) {
    4. print "I like apples."
    5. }
    6. when (/oranges?/) {
    7. print "I don't like oranges."
    8. }
    9. default {
    10. print "I don't like anything"
    11. }
    12. }

    See Switch statements in perlsyn for detailed information.