=head1 NAME X perlfunc - Perl builtin functions J<< ja; perlfunc - Perl 組み込み関数 >> =head1 DESCRIPTION The functions in this section can serve as terms in an expression. They fall into two major categories: list operators and named unary operators. These differ in their precedence relationship with a following comma. (See the precedence table in L.) List operators take more than one argument, while unary operators can never take more than one argument. Thus, a comma terminates the argument of a unary operator, but merely separates the arguments of a list operator. A unary operator generally provides a scalar context to its argument, while a list operator may provide either scalar or list contexts for its arguments. If it does both, the scalar arguments will be first, and the list argument will follow. (Note that there can ever be only one such list argument.) For instance, splice() has three scalar arguments followed by a list, whereas gethostbyname() has four scalar arguments. J<< ja; このセクションでは関数は式の中の項として提供されます. これには2つの大きな分類があります: リスト演算子と名前付 単項演算子です. これらの違いは続くコンマとの優先関係にあります. (L にある優先順位表で確認してださい.) リスト演算子は 1つ以上の引数をとり, 一方単項演算子は引数を取らないか1つの 引数を取ります. つまり, コンマは単項演算子の引数は閉じますが, リスト演算子の引数では単に引数を区切るだけです. 単項演算子は おおよそその引数にスカラコンテキストを提供し, リスト演算子は その引数にスカラーかリストコンテキストのどちらも提供します. もし両方だった場合にははじめにスカラ引数で, その後にリスト引数が 続きます. (以前にはそのようなリスト引数が1つだけありました.) 例えば, gethostbyname() は4つのスカラ引数を取るのに対して, splice() は3つのスカラー引数とそれに続くリストを取ります. >> In the syntax descriptions that follow, list operators that expect a list (and provide list context for the elements of the list) are shown with LIST as an argument. Such a list may consist of any combination of scalar arguments or list values; the list values will be included in the list as if each individual element were interpolated at that point in the list, forming a longer single-dimensional list value. Commas should separate elements of the LIST. J<< ja; 後述の構文の説明で, リストを受け取る(そしてリストの要素に リストコンテキストを提供する)リスト演算子は引数に LIST と 表記します. そのようなリストはスカラ引数やリスト値で構成される かもしれません; リスト値にはリストの中であたかも個々の要素が その時点で, 長い1次元のリスト値を形成してそこにあるかのよう にして含まれます. コンマは LIST の要素を区切ります. >> Any function in the list below may be used either with or without parentheses around its arguments. (The syntax descriptions omit the parentheses.) If you use the parentheses, the simple (but occasionally surprising) rule is this: It I like a function, therefore it I a function, and precedence doesn't matter. Otherwise it's a list operator or unary operator, and precedence does matter. And whitespace between the function and left parenthesis doesn't count--so you need to be careful sometimes: J<< ja; リストの続く関数は何であれその引数をくるむ括弧はあってもなくても 使えます. (構文の説明では括弧は省略しています.) もし括弧を使うのであれば, そのシンプルな(しかし時々びっくりする)ルールは次のようになります: それが関数のようにI<見えれば>, それは関数I<であり>, 優先順位は 関係ありません. それ以外であればリスト演算子若しくは単項演算子であり, 優先順位も意味を持ちます. そして関数と引数の間の空白からは 意味を汲みません -- これには時々注意する必要があります: >> print 1+2+4; # Prints 7. print(1+2) + 4; # Prints 3. print (1+2)+4; # Also prints 3! print +(1+2)+4; # Prints 7. print ((1+2)+4); # Prints 7. If you run Perl with the B<-w> switch it can warn you about this. For example, the third line above produces: J<< ja; Perl を B<-w> スイッチを有効にして実行しているときにはこれは警告を 得ることが出来ます. 例えば今の例の3行目では次の警告が生成されます: >> print (...) interpreted as function at - line 1. Useless use of integer addition in void context at - line 1. A few functions take no arguments at all, and therefore work as neither unary nor list operators. These include such functions as C