"Perl Programmers Reference Guide (англ.) (программ.) /19.12.1998/ " - читать интересную книгу автора

}

That's usually preferable because otherwise you won't
treat IEEE notations like NaN or Infinity properly. At
other times you might prefer to use the POSIX::strtod
function or a regular expression to check whether data is
numeric. See the _p_e_r_l_r_e manpage for details on regular
expressions.

warn "has nondigits" if /\D/;
warn "not a natural number" unless /^\d+$/; # rejects -3
warn "not an integer" unless /^-?\d+$/; # rejects +3
warn "not an integer" unless /^[+-]?\d+$/;
warn "not a decimal number" unless /^-?\d+\.?\d*$/; # rejects .2
warn "not a decimal number" unless /^-?(?:\d+(?:\.\d*)?|\.\d+)$/;
warn "not a C float"
unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;

The length of an array is a scalar value. You may find
the length of array @days by evaluating $#days, as in ccccsssshhhh.



14/Jun/98 perl 5.005, patch 02 11





PERLDATA(1) Perl Programmers Reference Guide PERLDATA(1)


(Actually, it's not the length of the array, it's the
subscript of the last element, because there is
(ordinarily) a 0th element.) Assigning to $#days changes
the length of the array. Shortening an array by this
method destroys intervening values. Lengthening an array
that was previously shortened _N_O _L_O_N_G_E_R recovers the
values that were in those elements. (It used to in Perl
4, but we had to break this to make sure destructors were
called when expected.) You can also gain some miniscule
measure of efficiency by pre-extending an array that is
going to get big. (You can also extend an array by
assigning to an element that is off the end of the array.)
You can truncate an array down to nothing by assigning the
null list () to it. The following are equivalent:

@whatever = ();
$#whatever = -1;