"Perl Programmers Reference Guide (англ.) (программ.) /19.12.1998/ " - читать интересную книгу автора );
Note that just because a hash is initialized in that order doesn't mean that it comes out in that order. See the sort entry in the _p_e_r_l_f_u_n_c manpage for examples of how to arrange for an output ordering. TTTTyyyyppppeeeegggglllloooobbbbssss aaaannnndddd FFFFiiiilllleeeehhhhaaaannnnddddlllleeeessss Perl uses an internal type called a _t_y_p_e_g_l_o_b to hold an entire symbol table entry. The type prefix of a typeglob is a *, 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: 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 the section on _S_y_m_b_o_l _T_a_b_l_e_s in the _p_e_r_l_m_o_d manpage 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 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 the _p_e_r_l_s_u_b manpage for examples of using these as indirect filehandles in functions. Typeglobs are also a way to create a local filehandle |
|
|