September 2002
Intermediate to advanced
496 pages
10h
English
There is a close relationship between an operator and a function. For example, Perl uses ** for exponentiation, whereas some languages use the pow function to achieve the same result. Likewise, Perl uses the % symbol for the remaindering operation, while other languages use the MOD function to achieve the same result. Thus, in this section we present some simple but useful functions that you can use on scalars.
The length function returns the length of a scalar.
$string="This\tstring\nconsists\nof a few\nlines\n"; $len = length($string); # length = 36
Remember that the \t sequence represents the tab character and the \n sequence represents the newline character. Thus, each of these sequences counts as a ...