argra****@users*****
argra****@users*****
2008年 2月 15日 (金) 00:25:09 JST
Index: docs/perl/5.10.0/perlfunc.pod diff -u docs/perl/5.10.0/perlfunc.pod:1.3 docs/perl/5.10.0/perlfunc.pod:1.4 --- docs/perl/5.10.0/perlfunc.pod:1.3 Fri Jan 11 05:51:27 2008 +++ docs/perl/5.10.0/perlfunc.pod Fri Feb 15 00:25:09 2008 @@ -1407,10 +1407,9 @@ =end original -C<$hinthash> is a reference to a hash containing the value of C<%^H> when the -caller was compiled, or C<undef> if C<%^H> was empty. Do not modify the values -of this hash, as they are the actual values stored in the optree. -(TBT) +C<$hinthash> は、caller がコンパイルされた時の C<%^H> の値を含む +ハッシュへのリファレンスか、あるいは C<%^H> が空の場合は C<undef> です。 +このハッシュの値は構文木に保管されている実際の値なので、変更しないで下さい。 =begin original @@ -1480,10 +1479,10 @@ =end original -On systems that support fchdir, you might pass a file handle or -directory handle as argument. On systems that don't support fchdir, -passing handles produces a fatal error at run time. -(TBT) +fchdir に対応しているシステムでは、ファイルハンドルやディレクトリハンドルを +引数として渡せます。 +fchdir に対応していないシステムでは、ハンドルを渡すと実行時に +致命的エラーになります。 =item chmod LIST X<chmod> X<permission> X<mode> @@ -1521,12 +1520,12 @@ =end original -On systems that support fchmod, you might pass file handles among the -files. On systems that don't support fchmod, passing file handles -produces a fatal error at run time. The file handles must be passed -as globs or references to be recognized. Barewords are considered -file names. -(TBT) +fchmod に対応しているシステムでは、ファイルハンドルを引数として渡せます。 +fchmod に対応していないシステムでは、ファイルハンドルを渡すと実行時に +致命的エラーになります。 +ファイルハンドルを認識させるためには、グロブまたはリファレンスとして +渡されなければなりません。 +裸の単語はファイル名として扱われます。 open(my $fh, "<", "foo"); my $perm = (stat $fh)[2] & 07777; @@ -1729,12 +1728,12 @@ =end original -On systems that support fchown, you might pass file handles among the -files. On systems that don't support fchown, passing file handles -produces a fatal error at run time. The file handles must be passed -as globs or references to be recognized. Barewords are considered -file names. -(TBT) +fchown に対応しているシステムでは、ファイルハンドルを引数として渡せます。 +fchown に対応していないシステムでは、ファイルハンドルを渡すと実行時に +致命的エラーになります。 +ファイルハンドルを認識させるためには、グロブまたはリファレンスとして +渡されなければなりません。 +裸の単語はファイル名として扱われます。 =begin original @@ -1800,10 +1799,9 @@ =end original -Negative values give the Unicode replacement character (chr(0xfffd)), -except under the L<bytes> pragma, where low eight bits of the value -(truncated to an integer) are used. -(TBT) +負の数は Unicode の置換文字 (chr(0xfffd)) を与えますが、 +L<bytes> プラグマの影響下では、(integer に切り詰められた)値の下位 8 ビットが +使われます。 =begin original @@ -2125,13 +2123,12 @@ =end original -crypt() is a one-way hash function. The PLAINTEXT and SALT is turned -into a short string, called a digest, which is returned. The same -PLAINTEXT and SALT will always return the same string, but there is no -(known) way to get the original PLAINTEXT from the hash. Small -changes in the PLAINTEXT or SALT will result in large changes in the -digest. -(TBT) +crypt() は一方向ハッシュ関数です。 +PLAINTEXT と SALT はダイジェストと呼ばれる短い文字列に変えられて、 +それが返されます。 +PLAINTEXT と SALT が同じ場合は常に同じ文字列を返しますが、ハッシュから +元の PLAINTEXT を得る(既知の)方法はありません。 +PLAINTEXT や SALT を少し変更してもダイジェストは大きく変更されます。 =begin original @@ -2147,16 +2144,17 @@ =end original -There is no decrypt function. This function isn't all that useful for -cryptography (for that, look for F<Crypt> modules on your nearby CPAN -mirror) and the name "crypt" is a bit of a misnomer. Instead it is -primarily used to check if two pieces of text are the same without -having to transmit or store the text itself. An example is checking -if a correct password is given. The digest of the password is stored, -not the password itself. The user types in a password that is -crypt()'d with the same salt as the stored digest. If the two digests -match the password is correct. -(TBT) +複合化関数はありません。 +この関数は暗号化のためにはまったく役に立ちません(このためには、 +お近くの CPAN ミラーで F<Crypt> モジュールを探してください)ので、 +"crypt" という名前は少し間違った名前です。 +その代わりに、一般的には二つのテキスト片が同じかどうかをテキストそのものを +転送したり保管したりせずにチェックするために使います。 +例としては、正しいパスワードが与えられたかどうかをチェックがあります。 +パスワード自身ではなく、パスワードのダイジェストが保管されます。 +ユーザーがパスワードを入力すると、保管されているダイジェストと同じ +salt で crypt() します。 +二つのダイジェストが同じなら、パスワードは正しいです。 =begin original @@ -4373,10 +4371,9 @@ =end original これは、C<format> が使用する内部関数ですが、直接呼び出すこともできます。 -これは、PICTURE の内容にしたがって、 -LIST の値を整形し (perlform manpage を参照してください)、 -結果をフォーマット出力アキュムレータ -C<$^A>(English モジュールでは C<$ACCUMULATOR>) に納めます。 +これは、PICTURE の内容にしたがって、LIST の値を整形し (L<perlform> を +参照してください)、結果をフォーマット出力アキュムレータC<$^A> +(English モジュールでは C<$ACCUMULATOR>) に納めます。 最終的に、C<write> が実行されると、C<$^A> の中身が、 何らかのファイルハンドルに書き出されます。 また、自分で C<$^A> を読んで、C<$^A> の内容を C<""> に戻してもかまいません。 @@ -4461,10 +4458,10 @@ =end original -C<POSIX::getattr> 関数は POSIX 準拠を主張するシステムで -これをより移植性のある形で行います。お近くの CPAN サイトから -C<Term::ReadKey> モジュールも参照して下さい; CPAN に関する詳細は -L<perlmodlib/CPAN> にあります。 +C<POSIX::getattr> 関数は POSIX 準拠を主張するシステムでこれを +より移植性のある形で行います。 +お近くの CPAN サイトから C<Term::ReadKey> モジュールも参照して下さい; +CPAN に関する詳細は L<perlmodlib/CPAN> にあります。 =item getlogin X<getlogin> X<login> @@ -4574,7 +4571,7 @@ プロセス、プロセスグループ、ユーザに対する現在の優先度を返します。 (L<getpriority(2)> を参照してください。) getpriority(2) を実装していない -マシンで実行した場合には、例外が発生します。 +マシンで実行した場合には、致命的例外が発生します。 =item getpwnam NAME X<getpwnam> X<getgrnam> X<gethostbyname> X<getnetbyname> X<getprotobyname> @@ -4904,15 +4901,15 @@ =end original -Queries the option named OPTNAME associated with SOCKET at a given LEVEL. -Options may exist at multiple protocol levels depending on the socket -type, but at least the uppermost socket level SOL_SOCKET (defined in the -C<Socket> module) will exist. To query options at another level the -protocol number of the appropriate protocol controlling the option -should be supplied. For example, to indicate that an option is to be -interpreted by the TCP protocol, LEVEL should be set to the protocol -number of TCP, which you can get using getprotobyname. -(TBT) +与えられた LEVEL で SOCKET に関連付けられた OPTNAME と言う名前のオプションを +問い合わせます。 +オプションはソケットの種類に依存しした複数のプロトコルレベルに存在することも +ありますが、少なくとも最上位ソケットレベル SOL_SOCKET (C<Socket> モジュールで +定義されています)は存在します。 +その他のレベルのオプションを問い合わせるには、そのオプションを制御する +適切なプロトコルのプロトコル番号を指定します。 +例えば、オプションが TCP プロトコルで解釈されるべきであることを示すためには、 +LEVEL は getprotobyname で得られる TCP のプロトコル番号を設定します。 =begin original @@ -4925,13 +4922,13 @@ =end original -The call returns a packed string representing the requested socket option, -or C<undef> if there is an error (the error reason will be in $!). What -exactly is in the packed string depends in the LEVEL and OPTNAME, consult -your system documentation for details. A very common case however is that -the option is an integer, in which case the result will be a packed -integer which you can decode using unpack with the C<i> (or C<I>) format. -(TBT) +この呼び出しは、要求されたソケットオプションの pack された文字列表現か、 +あるいはエラーがある場合は C<undef> を返します(エラーの理由は $! にあります)。 +pack された文字列の正確な中身は LEVEL と OPTNAME に依存するので、 +詳細についてはシステムドキュメントを確認してください。 +しかし、とても一般的な場合というのはオプションが整数の場合で、この場合 +結果は unpack の C<i> (あるいは C<I>)フォーマットでデコードできる pack された +整数です。 =begin original @@ -5194,11 +5191,10 @@ =end original -If C<$_> is lexical in the scope where the C<grep> appears (because it has -been declared with C<my $_>) then, in addition to being locally aliased to -the list elements, C<$_> keeps being lexical inside the block; i.e. it -can't be seen from the outside, avoiding any potential side-effects. -(TBT) +(C<my $_> として宣言されることによって) C<$_> が C<grep> が現れるスコープ内で +レキシカルな場合は、ローカルではリスト要素へのエイリアスであることに加えて、 +C<$_> はブロック内でレキシカルでありつづけます; つまり、外側からは見えず、 +起こりうる副作用を回避します。 =begin original @@ -5844,8 +5840,7 @@ あなたはが本当に望んでいるのは C<my> の方でしょう。 C<local> はほとんどの人々が「ローカル」と考えるものと違うからです。 -詳細はL<perlsub/"Private Variables -via my()">を参照してください。 +詳細は L<perlsub/"Private Variables via my()"> を参照してください。 =begin original @@ -6240,11 +6235,10 @@ =end original -If C<$_> is lexical in the scope where the C<map> appears (because it has -been declared with C<my $_>), then, in addition to being locally aliased to -the list elements, C<$_> keeps being lexical inside the block; that is, it -can't be seen from the outside, avoiding any potential side-effects. -(TBT) +(C<my $_> として宣言されることによって) C<$_> が C<map> が現れるスコープ内で +レキシカルな場合は、ローカルではリスト要素へのエイリアスであることに加えて、 +C<$_> はブロック内でレキシカルでありつづけます; つまり、外側からは見えず、 +起こりうる副作用を回避します。 =begin original @@ -7282,9 +7276,9 @@ =end original ファイルに対する close-on-exec フラグをサポートしているシステムでは、 -フラグは$^F の値で決定される、新しくオープンされたファイル記述子に対して +フラグは $^F の値で決定される、新しくオープンされたファイル記述子に対して セットされます。 -L<perlvar/$^F>を参照してください。 +L<perlvar/$^F> を参照してください。 =begin original @@ -7459,6 +7453,7 @@ DIRHANDLE が未定義のスカラ値(または配列かハッシュの要素)の場合、その変数は 新しい無名ディレクトリハンドルへのリファレンスが代入されます。 DIRHANDLE は、FILEHANDLE とは別に名前空間を持っています。 +(TBT) =item ord EXPR X<ord> X<encoding> @@ -7506,12 +7501,12 @@ =end original -C<our> associates a simple name with a package variable in the current -package for use within the current scope. When C<use strict 'vars'> is in -effect, C<our> lets you use declared global variables without qualifying -them with package names, within the lexical scope of the C<our> declaration. -In this way C<our> differs from C<use vars>, which is package scoped. -(TBT) +C<our> は単純名を、現在のスコープ内で使うために、現在のパッケージの +パッケージ変数と結び付けます。 +C<use strict 'vars'> が有効の場合は、C<our> を使うことで、C<our> 宣言の +レキシカルスコープ内で、宣言されたグローバル変数をパッケージ名で +修飾することなく使うことができます。 +この意味では、C<use vars> はパッケージスコープなので、C<our> とは異なります。 =begin original @@ -7524,13 +7519,11 @@ =end original -Unlike C<my>, which both allocates storage for a variable and associates -a simple name with that storage for use within the current scope, C<our> -associates a simple name with a package variable in the current package, -for use within the current scope. In other words, C<our> has the same -scoping rules as C<my>, but does not necessarily create a -variable. -(TBT) +記憶領域を変数に割り当て、単純名を現在のスコープ内で使うためにその記憶領域に +割り当てる C<my> と違って、C<our> は単純名を、現在のスコープ内で使うために、 +現在のパッケージのパッケージ変数と結び付けます。 +言い換えると、C<our> は C<my> と同じスコープルールを持ちますが、 +変数を作る必要はありません。 =begin original @@ -7976,14 +7969,13 @@ =end original -When used with C<.>, the repeat count is used to determine the starting -position from where the value offset is calculated. If the repeat count -is 0, it's relative to the current position. If the repeat count is C<*>, -the offset is relative to the start of the packed string. And if its an -integer C<n> the offset is relative to the start of the n-th innermost -() group (or the start of the string if C<n> is bigger then the group -level). -(TBT) +C<.> で使われると、繰り返し数は値のオフセットを計算するための開始位置を +決定するために使われます。 +繰り返し数が 0 なら、現在位置からの相対位置となります。 +繰り返し数が C<*> なら、オフセットは pack された文字列の先頭からの相対位置です。 +そして整数 C<n> なら、オフセットは一番内側から n 番目の () グループの先頭 +(または C<n> がグループレベルより大きい場合は文字列の先頭)からの +相対位置です。 =begin original @@ -8237,11 +8229,10 @@ =end original -For C<pack>, the I<sequence-item> may have a repeat count, in which case -the minimum of that and the number of available items is used as argument -for the I<length-item>. If it has no repeat count or uses a '*', the number -of available items is used. -(TBT) +C<pack> では、I<sequence-item> は繰り返し数を持つことがあり、その場合は +その最小値と利用可能なアイテムの数は I<length-item> のための引数として +使われます。 +繰り返し数がなかったり、'*' を使うと、利用可能なアイテムの数が使われます。 =begin original @@ -8252,11 +8243,10 @@ =end original -For C<unpack> an internal stack of integer arguments unpacked so far is -used. You write C</>I<sequence-item> and the repeat count is obtained by -popping off the last element from the stack. +C<unpack> では、今まで unpack した数値引数の内部スタックが使われます。 +C</>I<sequence-item> と書いて、繰り返し数はスタックから最後の要素を +取り出すことで得ます。 I<sequence-item> は繰り返し数を持っていてはいけません。 -(TBT) =begin original @@ -8267,11 +8257,10 @@ =end original -If the I<sequence-item> refers to a string type (C<"A">, C<"a"> or C<"Z">), -the I<length-item> is a string length, not a number of strings. If there is -an explicit repeat count for pack, the packed string will be adjusted to that -given length. -(TBT) +I<sequence-item> が文字列型 (C<"A">, C<"a">, C<"Z">) を参照している場合、 +I<length-item> は文字列の数ではなく、文字列の長さです。 +pack で明示的な繰り返し数があると、pack された文字列は与えられた +長さに調整されます。 unpack 'W/a', "\04Gurusamy"; gives ('Guru') unpack 'a3/A A*', '007 Bond J '; gives (' Bond', 'J') @@ -8486,6 +8475,13 @@ =end original +All integer and floating point formats as well as C<p> and C<P> and +C<()>-groups may be followed by the C<E<gt>> or C<E<lt>> modifiers +to force big- or little- endian byte-order, respectively. +This is especially useful, since C<n>, C<N>, C<v> and C<V> don't cover +signed integers, 64-bit integers and floating point values. However, +there are some things to keep in mind. +(TBT) =begin original @@ -8495,6 +8491,10 @@ =end original +Exchanging signed integers between different platforms only works +if all platforms store them in the same format. Most platforms store +signed integers in two's complement, so usually this is not an issue. +(TBT) =begin original @@ -8504,6 +8504,10 @@ =end original +The C<E<gt>> or C<E<lt>> modifiers can only be used on floating point +formats on big- or little-endian machines. Otherwise, attempting to +do so will result in a fatal error. +(TBT) =begin original @@ -8518,6 +8522,15 @@ =end original +Forcing big- or little-endian byte-order on floating point values for +data exchange can only work if all platforms are using the same +binary representation (e.g. IEEE floating point format). Even if all +platforms are using IEEE, there may be subtle differences. Being able +to use C<E<gt>> or C<E<lt>> on floating point values can be very useful, +but also very dangerous if you don't know exactly what you're doing. +It is definitely not a general way to portably store floating point +values. +(TBT) =begin original @@ -8529,6 +8542,12 @@ =end original +When using C<E<gt>> or C<E<lt>> on an C<()>-group, this will affect +all types inside the group that accept the byte-order modifiers, +including all subgroups. It will silently be ignored for all other +types. You are not allowed to override the byte-order within a group +that already has a byte-order modifier suffix. +(TBT) =item * @@ -8595,6 +8614,14 @@ =end original +Pack and unpack can operate in two modes, character mode (C<C0> mode) where +the packed string is processed per character and UTF-8 mode (C<U0> mode) +where the packed string is processed in its UTF-8-encoded Unicode form on +a byte by byte basis. Character mode is the default unless the format string +starts with an C<U>. You can switch mode at any moment with an explicit +C<C0> or C<U0> in the format. A mode is in effect until the next mode switch +or until the end of the ()-group in which it was entered. +(TBT) =item * @@ -8686,12 +8713,12 @@ =end original -C<n>, C<N>, C<v> and C<V> accept the C<!> modifier. In this case they -will represent signed 16-/32-bit integers in big-/little-endian order. -This is only portable if all platforms sharing the packed data use the -same binary representation for signed integers (e.g. all platforms are -using two's complement representation). -(TBT) +C<n>, C<N>, C<v>, C<V> は C<!> 修飾子を受け入れます。 +この場合、これらはビッグ/リトルエンディアンの順序で符号付き 16 または +32 ビット整数で表現されます。 +これは pack されたデータを共有する全てのプラットフォームが +符号付き整数について同じバイナリ表現を使う(つまり、全ての +プラットフォームで 2 の補数表現を使う)場合にのみ移植性があります。 =item * @@ -9013,15 +9040,14 @@ =end original 文字列か文字列のリストを出力します。 -成功時には、真を返します。FILEHANDLE は、 -スカラ変数名でもよく、その場合には、その変数にファイル -ハンドル名またはそのリファレンスが +成功時には、真を返します。FILEHANDLE は、スカラ変数名でもよく、 +その場合には、その変数にファイルハンドル名またはそのリファレンスが 入っているものとして扱われますから、一段階の間接指定が行なえます。 (注: FILEHANDLE に変数を使い、次のトークンが「項」のときには、 間に C<+> を置くか、引数の前後を括弧で括らなければ、 誤って解釈されることがあります。) -FILEHANDLE を省略した場合には、標準出力 (か、 -最後に選択された出力チャネル --- L</select>を参照) に出力します。 +FILEHANDLE を省略した場合には、標準出力 (か、最後に選択された出力チャネル +-- L</select>を参照) に出力します。 LIST も省略すると、C<$_> を現在選択されている出力チャネルに 出力することになります。 デフォルトの出力チャネルを STDOUT 以外にしたければ、select 演算子を @@ -9030,11 +9056,10 @@ print の引数は LIST なので、LISTの中のものは、 すべてリストコンテキストで評価されます。 サブルーチンの呼び出しがあれば、リストコンテキストでは、 -複数の値を返すかもしれません。また、すべての -引数を括弧で括るのでなければ、print というキーワードの +複数の値を返すかもしれません。 +また、すべての引数を括弧で括るのでなければ、print というキーワードの 次に開き括弧を書いてはいけません。 -"print" と引数の間に C<+> を書くか、 -すべての引数を括弧で括ってください。 +"print" と引数の間に C<+> を書くか、すべての引数を括弧で括ってください。 =begin original @@ -9072,7 +9097,7 @@ C<print FILEHANDLE sprintf(FORMAT, LIST)> と等価です。 リストの最初の要素は、C<printf> フォーマットと解釈されます。 フォーマット引数の説明については C<sprintf> を参照してください。 -C<use locale>が効力をもっていて、POSIX::setlocale() が呼び出されていれば、 +C<use locale> が効力をもっていて、POSIX::setlocale() が呼び出されていれば、 小数点に使われる文字は LC_NUMERIC ロケールの影響を受けます。 L<perllocale> と L<POSIX> を参照してください。 @@ -9134,7 +9159,8 @@ =end original ARRAY をスタックとして扱い、LIST 内の値を ARRAY の終わりにプッシュします。 -ARRAY の大きさは、LIST の長さ分だけ大きくなります。これは、 +ARRAY の大きさは、LIST の長さ分だけ大きくなります。 +これは、 for $value (LIST) { $ARRAY[++$#ARRAY] = $value; @@ -9167,7 +9193,7 @@ =end original 汎用のクォートです。 -L<perlop/"Regexp Quote-Like Operators">を参照してください。 +L<perlop/"Regexp Quote-Like Operators"> を参照してください。 =item quotemeta EXPR X<quotemeta> X<metacharacter> @@ -9217,7 +9243,7 @@ =end original C<0> 以上 EXPR の値未満の小数の乱数値を返します。 -(EXPRは正の数である必要があります。) +(EXPR は正の数である必要があります。) EXPR を省略すると、C<1> とみなします。 現在のところ、EXPR に値 C<0> をセットすると C<1> として特別扱いされます - これは perl 5.8.0 以前には文書化されておらず、将来のバージョンの perl では @@ -9681,11 +9707,11 @@ =end original -The return value C<LVALUE> indicates a reference to an lvalue that is not -a variable. You get this from taking the reference of function calls like -C<pos()> or C<substr()>. C<VSTRING> is returned if the reference points -to a L<version string|perldata/"Version Strings">. -(TBT) +返り値 C<LVALUE> は、変数ではない左辺値へのリファレンスを示します。 +これは、C<pos()> や C<substr()> のようの関数呼び出しのリファレンスから +得られます。 +C<VSTRING> は、リファレンスが L<version string|perldata/"Version Strings"> を +指している場合に返されます。 =begin original @@ -10043,12 +10069,11 @@ =end original -If an empty list, C<undef>, or nothing that matches the first 3 values above -is returned then C<require> will look at the remaining elements of @INC. -Note that this file handle must be a real file handle (strictly a typeglob, -or reference to a typeglob, blessed or unblessed) - tied file handles will be -ignored and return value processing will stop there. -(TBT) +空リスト、C<undef>、または上記の最初の 3 つの値のどれとも一致しないものが +返されると、C<require> は @INC の残りの要素を見ます。 +このファイルハンドルは実際のファイルハンドル(厳密には型グロブ、型グロブへの +リファレンス、bless されているかされていないか)である必要があります - +tie されたファイルハンドルは無視され、返り値の処理はそこで停止します。 =begin original @@ -10762,12 +10787,11 @@ =end original -Note: on some Unixes, the select(2) system call may report a socket file -descriptor as "ready for reading", when actually no data is available, -thus a subsequent read blocks. It can be avoided using always the -O_NONBLOCK flag on the socket. See select(2) and fcntl(2) for further -details. -(TBT) +注意: Unix の中には、実際に利用可能なデータがないために引き続く読み込みが +ブロックされる場合、select(2) システムコールが、ソケットファイル記述子が +「読み込み準備中」であると報告するものもあります。 +これは、ソケットに対して常に O_NONBLOCK フラグを使うことで回避できます。 +さらなる詳細については select(2) と fcntl(2) を参照してください。 =begin original @@ -11264,9 +11288,9 @@ =end original ファイルに対する close-on-exec フラグをサポートしているシステムでは、 -フラグは$^F の値で決定される、新しくオープンされたファイル記述子に対して +フラグは $^F の値で決定される、新しくオープンされたファイル記述子に対して セットされます。 -L<perlvar/$^F>を参照してください。 +L<perlvar/$^F> を参照してください。 =item socketpair SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL X<socketpair> @@ -11294,7 +11318,7 @@ =end original ファイルに対する close-on-exec フラグをサポートしているシステムでは、 -フラグは$^F の値で決定される、新しくオープンされたファイル記述子に対して +フラグは $^F の値で決定される、新しくオープンされたファイル記述子に対して セットされます。 L<perlvar/$^F> を参照してください。 @@ -11429,12 +11453,11 @@ =end original -sort() returns aliases into the original list, much as a for loop's index -variable aliases the list elements. That is, modifying an element of a -list returned by sort() (for example, in a C<foreach>, C<map> or C<grep>) -actually modifies the element in the original list. This is usually -something to be avoided when writing clear code. -(TBT) +sort() は元のリストへのエイリアスを返します; for ループのインデックス変数が +リスト要素へのエイリアスと同様です。 +つまり、sort() で返されるリストの要素を(例えば、C<foreach> や C<map> や +C<grep> で)変更すると、実際に元のリストの要素が変更されます。 +これはきれいなコードを書くことで普通は回避できます。 =begin original @@ -13339,10 +13362,9 @@ =end original -Note that the lvalue returned by the 3-arg version of substr() acts as -a 'magic bullet'; each time it is assigned to, it remembers which part -of the original string is being modified; for example: -(TBT) +3 引数の substr() によって返された左辺値は「魔法の弾丸」のように振舞うことに +注意してください; これが代入される毎に、元の文字列のどの部分が変更されたかが +思い出されます; 例えば: $x = '1234'; for (substr($x,1,2)) { @@ -14070,10 +14092,9 @@ =end original -Do not use tell() (or other buffered I/O operations) on a file handle -that has been manipulated by sysread(), syswrite() or sysseek(). -Those functions ignore the buffering, while tell() does not. -(TBT) +sysread(), syswrite(), sysseek() で操作されたファイルハンドルに tell() +(またはその他のバッファリング I/O 操作) を使わないでください。 +これらの関数はバッファリングを無視しますが、tell() は違います。 =item telldir DIRHANDLE X<telldir> @@ -15194,12 +15215,12 @@ =end original -On systems that support futimes, you might pass file handles among the -files. On systems that don't support futimes, passing file handles -produces a fatal error at run time. The file handles must be passed -as globs or references to be recognized. Barewords are considered -file names. -(TBT) +futimes に対応しているシステムでは、ファイルハンドルを引数として渡せます。 +futimes に対応していないシステムでは、ファイルハンドルを渡すと実行時に +致命的エラーになります。 +ファイルハンドルを認識させるためには、グロブまたはリファレンスとして +渡されなければなりません。 +裸の単語はファイル名として扱われます。 =item values HASH X<values> @@ -15365,11 +15386,10 @@ =end original -If the string happens to be encoded as UTF-8 internally (and thus has -the UTF8 flag set), this is ignored by C<vec>, and it operates on the -internal byte string, not the conceptual character string, even if you -only have characters with values less than 256. -(TBT) +文字列がなぜか内部で UTF-8 でエンコードされている場合(したがって UTF8 フラグが +セットされている場合)、これは C<vec> では無視され、たとえ値が 256 未満の +文字だけであったとしても、概念的な +文字列ではなく内部バイト文字列で操作されます。 =begin original Index: docs/perl/5.10.0/perlop.pod diff -u docs/perl/5.10.0/perlop.pod:1.1 docs/perl/5.10.0/perlop.pod:1.2 --- docs/perl/5.10.0/perlop.pod:1.1 Fri Jan 11 05:51:27 2008 +++ docs/perl/5.10.0/perlop.pod Fri Feb 15 00:25:09 2008 @@ -622,9 +622,8 @@ =end original -is not ok, as the regex engine will end up trying to compile the -pattern C<\>, which it will consider a syntax error. -(TBT) +は正しくありません; 正規表現エンジンは最終的にパターン C<\> を +コンパイルしようとして、これは文法エラーと考えるからです。 =begin original @@ -1111,12 +1110,12 @@ =end original -Binary "~~" does a smart match between its arguments. Smart matching -is described in L<perlsyn/"Smart matching in detail">. -This operator is only available if you enable the "~~" feature: -see L<feature> for more information. +二項演算子の "~~" はスマートマッチングとして働きます。 +スマートマッチングについては L<perlsyn/"Smart matching in detail"> で +述べられています。 +この演算子は "~~" 機能が有効な場合にのみ使用可能です: +更なる情報については L<feature> を参照してください。 X<~~> -(TBT) =begin original @@ -2519,11 +2518,10 @@ I<STRING> は C<m/PATTERN/> 内の I<PATTERN> と同様に文字変換されます。 "'" がデリミタとして使用された場合、文字変換は行われません。 対応する C</STRING/msixpo> 表現の代わりに使われた Perl の値を返します。 -The returned value is a -normalized version of the original pattern. It magically differs from -a string containing the same characters: C<ref(qr/x/)> returns "Regexp", -even though dereferencing the result returns undef. -(TBT) +返り値は元のパターンを正規化したものです。 +これは不思議なことに、同じ文字を含む文字列とは異なります: +C<ref(qr/x/)> は、結果をデリファレンスすると未定義値を返すにも関わらず、 +"Regexp" を返します。 =begin original @@ -2623,10 +2621,9 @@ s 文字列を一行として扱う (. が 改行にマッチングするようにする) i パターンマッチにおいて大文字小文字を区別しない x 拡張正規表現を使う - p When matching preserve a copy of the matched string so - that ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH} will be defined. + p マッチング時にマッチングした文字列を保存するので、 + ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH} が定義される o 一度だけコンパイルする - (TBT) =begin original @@ -3404,9 +3401,9 @@ =end original -The STDIN filehandle used by the command is inherited from Perl's STDIN. -For example: -(TBT) +コマンドによって使われる STDIN ファイルハンドルは Perl の STDIN を +継承します。 +例えば: open BLAM, "blam" || die "Can't open: $!"; open STDIN, "<&BLAM"; @@ -3418,8 +3415,7 @@ =end original -will print the sorted contents of the file "blam". -(TBT) +はファイル "blam" の内容をソートして表示します。 =begin original @@ -3938,8 +3934,7 @@ =end original -It is possible to stack multiple here-docs in a row: -(TBT) +複数のヒヤドキュメントを連続してスタックすることも可能です: print <<"foo", <<"bar"; # you can stack them I said foo. @@ -3978,9 +3973,7 @@ =end original -If you want to remove the line terminator from your here-docs, -use C<chomp()>. -(TBT) +ヒヤドキュメントから行終端子を除去したい場合は、C<chomp()> を使ってください。 chomp($string = <<'END'); This is a string. @@ -4226,21 +4219,18 @@ =end original - 1 文字のデリミタを探す場合、エスケープされたデリミタと C<\\> は 読み飛ばします。 例えば、C</> を探しているときには、C<\\> と C<\/> の組み合わせを 読み飛ばします。 -If the delimiters are -bracketing, nested pairs are also skipped. +デリミタがかっこでくくられている場合は、ネストした組も読み飛ばされます。 例えば、開きの C<[> と組になる閉じの C<]> を探しているときには、 C<\\>, C<\]>, C<\[> の組み合わせをは全て読み飛ばし、 さらにネストした C<[>, C<]> も読み飛ばします。 -However, when backslashes are used as the delimiters (like C<qq\\> and -C<tr\\\>), nothing is skipped. -During the search for the end, backslashes that escape delimiters -are removed (exactly speaking, they are not copied to the safe location). -(TBT) +しかし、(C<qq\\> や C<tr\\\> のように)バックスラッシュがデリミタとして +使われた場合、何も読み飛ばしません。 +末尾の検索中、デリミタをエスケープするバックスラッシュは除去されます +(述べたとおりに正確に、安全な場所にコピーはされません)。 =begin original @@ -4260,9 +4250,9 @@ 3 つのデリミタからなる構造 (C<s///>, C<y///>, C<tr///>) の場合、 検索はもう一度繰り返されます。 -If the first delimiter is not an opening punctuation, three delimiters must -be same such as C<s!!!> and C<tr)))>, in which case the second delimiter -terminates the left part and starts the right part at once. +最初のデリミタが開きかっこでない場合、C<s!!!> and C<tr)))> のように +3 つのデリミタは同じでなければなりません; +この場合、2 番目のデリミタが左側の終端と右側の開始を同時に行います。 If the left part is delimited by bracketing punctuations (that is C<()>, C<[]>, C<{}>, or C<< <> >>), the right part needs another pair of delimiters such as C<s(){}> and C<tr[]//>. In these cases, whitespaces @@ -4354,9 +4344,8 @@ =end original 展開は行われません。 -Note that the combination C<\\> is left intact, since escaped delimiters -are not available for here-docs. -(TBT) +C<\\> の組み合わせはそのままであることに注意してください; +ヒヤドキュメントではデリミタのエスケープはできないからです。 =item C<m''>, the pattern of C<s'''> @@ -4385,10 +4374,9 @@ =end original C<\\> の組における C<\> の削除のみが行われます。 -Therefore C<-> in C<tr'''> and C<y'''> is treated literally -as a hyphen and no character range is available. -C<\1> in the replacement of C<s'''> does not work as C<$1>. -(TBT) +従って、C<tr'''> や C<y'''> の中にある C<-> は文字通りハイフンとして扱われ、 +文字範囲は使えません。 +C<s'''> の置換文字列での C<\1> は C<$1> としては動作しません。 =item C<tr///>, C<y///> @@ -4428,10 +4416,9 @@ 対応する Perl 構造に変換されます。 従って、C<"$foo\Qbaz$bar"> は内部的に C<$foo . (quotemeta("baz" . $bar))> に変換されます。 -The other escape sequences such as C<\200> and C<\t> and backslashed -characters such as C<\\> and C<\-> are -適切な拡張に置換されます。 -(TBT) +C<\200> や C<\t> のような、その他のエスケープシーケンスや、C<\\> や +C<\-> のような、バックスラッシュがつけられた文字は適切な拡張に +置換されます。 =begin original