www.perl.com
Perl Programming
List Context
  • Lists
    • In scalar context, returns the last item of the list
    • In list context, returns the entire list
  • Arrays
    • In scalar context, returns the length of the array
    • In list context, returns the entire array
  • Hashes
    • In scalar context, returns a measure of the space used
    • In list context, returns the entire hash

        $last_item = qw(goldfish cat dog); # $last_item = "dog";
        @pets      = qw(goldfish cat dog); # entire list

        $count     = @pets;                # $count = 3;
        @new_pets  = @pets;                # entire array

        %pets      = (goldfish => "glub",
                      cat      => "meow",
                      dog      => "woof");
        $boolean   = %pets;                # true
        @mix       = %pets;                # ("goldfish", ..., "woof")
        %new_pets  = %pets;                # entire hash
      
Previous http://stuff.mit.edu/iap/perl/