"Perl Programmers Reference Guide (англ.) (программ.) /19.12.1998/ " - читать интересную книгу автораkeys(%users) = 1000; # allocate 1024 buckets SSSSccccaaaallllaaaarrrr vvvvaaaalllluuuueeee ccccoooonnnnssssttttrrrruuuuccccttttoooorrrrssss Numeric literals are specified in any of the customary floating point or integer formats: 12345 12345.67 .23E-10 0xffff # hex 0377 # octal 4_294_967_296 # underline for legibility String literals are usually delimited by either single or double quotes. They work much like shell quotes: double- quoted string literals are subject to backslash and variable substitution; single-quoted strings are not (except for "\'" and "\\"). The usual Unix backslash rules apply for making characters such as newline, tab, etc., as well as some more exotic forms. See the section on _Q_u_o_t_e _a_n_d _Q_u_o_t_e_l_i_k_e _O_p_e_r_a_t_o_r_s in the _p_e_r_l_o_p manpage for a list. Octal or hex representations in string literals (e.g. '0xffff') are not automatically converted to their integer representation. The _h_e_x_(_) and _o_c_t_(_) functions make these conversions for you. See the hex entry in the _p_e_r_l_f_u_n_c manpage and the oct entry in the _p_e_r_l_f_u_n_c manpage for more details. You can also embed newlines directly in your strings, i.e., they can end on a different line than they begin. This is nice, but if you forget your trailing quote, the error will not be reported until Perl finds another line containing the quote character, which may be much further on in the script. Variable substitution inside strings is limited to scalar variables, arrays, and array slices. (In other words, names beginning with $ or @, followed by an optional bracketed expression as a subscript.) The following code segment prints out "The price is $100." $Price = '$100'; # not interpreted print "The price is $Price.\n"; # interpreted As in some shells, you can put curly brackets around the name to delimit it from following alphanumerics. In fact, an identifier within such curlies is forced to be a |
|
|