- return EXPR
- return
-
Returns from a subroutine,
eval
,do FILE
,sort
block or regex eval block (but not agrep
,map
, ordo BLOCK
block) with the value given in EXPR. Evaluation of EXPR may be in list, scalar, or void context, depending on how the return value will be used, and the context may vary from one execution to the next (seewantarray
). If no EXPR is given, returns an empty list in list context, the undefined value in scalar context, and (of course) nothing at all in void context.サブルーチン,
eval
,do FILE
,sort
ブロックまたは正規表現 eval ブロック (但しgrep
,map
,do BLOCK
ブロックではない) から EXPR で与えられた値をもって、リターンします。 EXPR の評価は、返り値がどのように使われるかによってリスト、スカラ、 無効コンテキストになります; またコンテキストは実行毎に変わります (wantarray
を参照してください)。 EXPR が指定されなかった場合は、リストコンテキストでは空リストを、 スカラコンテキストでは未定義値を返します; そして(もちろん) 無効コンテキストでは何も返しません。(In the absence of an explicit
return
, a subroutine,eval
, ordo FILE
automatically returns the value of the last expression evaluated.)(サブルーチン,
eval
,do FILE
に明示的にreturn
がなければ、最後に評価された値で、 自動的にリターンします。)Unlike most named operators, this is also exempt from the looks-like-a-function rule, so
return ("foo")."bar"
will cause"bar"
to be part of the argument toreturn
.ほとんどの名前付き演算子と異なり、関数のように見えるものの規則からも 免れるので、
return ("foo")."bar"
とすると"bar"
はreturn
への引数の一部となります。