+ $dir = (getpwnam("daemon"))[7];
+
+=head2 Multi-dimensional array emulation
+
+Multidimensional arrays may be emulated by subscripting a hash with a
+list. The elements of the list are joined with the subscript separator
+(see L<perlvar/$;>).
+
+ $foo{$a,$b,$c}
+
+is equivalent to
+
+ $foo{join($;, $a, $b, $c)}
+
+The default subscript separator is "\034", the same as SUBSEP in B<awk>.
+
+=head2 Slices
+X<slice> X<array, slice> X<hash, slice>
+
+A slice accesses several elements of a list, an array, or a hash
+simultaneously using a list of subscripts. It's more convenient
+than writing out the individual elements as a list of separate
+scalar values.
+
+ ($him, $her) = @folks[0,-1]; # array slice
+ @them = @folks[0 .. 3]; # array slice
+ ($who, $home) = @ENV{"USER", "HOME"}; # hash slice
+ ($uid, $dir) = (getpwnam("daemon"))[2,7]; # list slice
+
+Since you can assign to a list of variables, you can also assign to
+an array or hash slice.
+
+ @days[3..5] = qw/Wed Thu Fri/;
+ @colors{'red','blue','green'}
+ = (0xff0000, 0x0000ff, 0x00ff00);
+ @folks[0, -1] = @folks[-1, 0];
+
+The previous assignments are exactly equivalent to
+
+ ($days[3], $days[4], $days[5]) = qw/Wed Thu Fri/;
+ ($colors{'red'}, $colors{'blue'}, $colors{'green'})
+ = (0xff0000, 0x0000ff, 0x00ff00);
+ ($folks[0], $folks[-1]) = ($folks[-1], $folks[0]);
+
+Since changing a slice changes the original array or hash that it's
+slicing, a C<foreach> construct will alter some--or even all--of the
+values of the array or hash.
+
+ foreach (@array[ 4 .. 10 ]) { s/peter/paul/ }
+
+ foreach (@hash{qw[key1 key2]}) {
+ s/^\s+//; # trim leading whitespace
+ s/\s+$//; # trim trailing whitespace
+ s/(\w+)/\u\L$1/g; # "titlecase" words
+ }
+
+A slice of an empty list is still an empty list. Thus:
+
+ @a = ()[1,0]; # @a has no elements
+ @b = (@a)[0,1]; # @b has no elements
+ @c = (0,1)[2,3]; # @c has no elements
+
+But:
+
+ @a = (1)[1,0]; # @a has two elements
+ @b = (1,undef)[1,0,2]; # @b has three elements
+
+This makes it easy to write loops that terminate when a null list
+is returned:
+
+ while ( ($home, $user) = (getpwent)[7,0]) {
+ printf "%-8s %s\n", $user, $home;
+ }
+
+As noted earlier in this document, the scalar sense of list assignment
+is the number of elements on the right-hand side of the assignment.
+The null list contains no elements, so when the password file is
+exhausted, the result is 0, not 2.
+
+Slices in scalar context return the last item of the slice.
+
+ @a = qw/first second third/;
+ %h = (first => 'A', second => 'B');
+ $t = @a[0, 1]; # $t is now 'second'
+ $u = @h{'first', 'second'}; # $u is now 'B'
+
+If you're confused about why you use an '@' there on a hash slice
+instead of a '%', think of it like this. The type of bracket (square
+or curly) governs whether it's an array or a hash being looked at.
+On the other hand, the leading symbol ('$' or '@') on the array or
+hash indicates whether you are getting back a singular value (a
+scalar) or a plural one (a list).
+
+=head2 Typeglobs and Filehandles
+X<typeglob> X<filehandle> X<*>
+
+Perl uses an internal type called a I<typeglob> to hold an entire
+symbol table entry. The type prefix of a typeglob is a C<*>, because
+it represents all types. This used to be the preferred way to
+pass arrays and hashes by reference into a function, but now that
+we have real references, this is seldom needed.
+
+The main use of typeglobs in modern Perl is create symbol table aliases.
+This assignment:
+
+ *this = *that;
+
+makes $this an alias for $that, @this an alias for @that, %this an alias
+for %that, &this an alias for &that, etc. Much safer is to use a reference.
+This:
+
+ local *Here::blue = \$There::green;
+
+temporarily makes $Here::blue an alias for $There::green, but doesn't
+make @Here::blue an alias for @There::green, or %Here::blue an alias for
+%There::green, etc. See L<perlmod/"Symbol Tables"> for more examples
+of this. Strange though this may seem, this is the basis for the whole
+module import/export system.
+
+Another use for typeglobs is to pass filehandles into a function or
+to create new filehandles. If you need to use a typeglob to save away
+a filehandle, do it this way:
+
+ $fh = *STDOUT;
+
+or perhaps as a real reference, like this:
+
+ $fh = \*STDOUT;
+
+See L<perlsub> for examples of using these as indirect filehandles
+in functions.
+
+Typeglobs are also a way to create a local filehandle using the local()
+operator. These last until their block is exited, but may be passed back.
+For example:
+
+ sub newopen {
+ my $path = shift;
+ local *FH; # not my!
+ open (FH, $path) or return undef;
+ return *FH;
+ }
+ $fh = newopen('/etc/passwd');
+
+Now that we have the C<*foo{THING}> notation, typeglobs aren't used as much
+for filehandle manipulations, although they're still needed to pass brand
+new file and directory handles into or out of functions. That's because
+C<*HANDLE{IO}> only works if HANDLE has already been used as a handle.
+In other words, C<*FH> must be used to create new symbol table entries;
+C<*foo{THING}> cannot. When in doubt, use C<*FH>.
+
+All functions that are capable of creating filehandles (open(),
+opendir(), pipe(), socketpair(), sysopen(), socket(), and accept())
+automatically create an anonymous filehandle if the handle passed to
+them is an uninitialized scalar variable. This allows the constructs
+such as C<open(my $fh, ...)> and C<open(local $fh,...)> to be used to
+create filehandles that will conveniently be closed automatically when
+the scope ends, provided there are no other references to them. This
+largely eliminates the need for typeglobs when opening filehandles
+that must be passed around, as in the following example:
+
+ sub myopen {
+ open my $fh, "@_"
+ or die "Can't open '@_': $!";
+ return $fh;
+ }
+
+ {
+ my $f = myopen("</etc/motd");
+ print <$f>;
+ # $f implicitly closed here
+ }
+
+Note that if an initialized scalar variable is used instead the
+result is different: C<my $fh='zzz'; open($fh, ...)> is equivalent
+to C<open( *{'zzz'}, ...)>.
+C<use strict 'refs'> forbids such practice.
+
+Another way to create anonymous filehandles is with the Symbol
+module or with the IO::Handle module and its ilk. These modules
+have the advantage of not hiding different types of the same name
+during the local(). See the bottom of L<perlfunc/open> for an
+example.
+
+=head1 SEE ALSO
+
+See L<perlvar> for a description of Perl's built-in variables and
+a discussion of legal variable names. See L<perlref>, L<perlsub>,
+and L<perlmod/"Symbol Tables"> for more discussion on typeglobs and
+the C<*foo{THING}> syntax.