[perldocjp-cvs 1530] CVS update: docs/articles/qntm.org/files/perl

Back to archive index

ktats****@users***** ktats****@users*****
2012年 9月 1日 (土) 04:42:07 JST


Index: docs/articles/qntm.org/files/perl/perl.html
diff -u docs/articles/qntm.org/files/perl/perl.html:1.6 docs/articles/qntm.org/files/perl/perl.html:1.7
--- docs/articles/qntm.org/files/perl/perl.html:1.6	Sat Sep  1 01:58:59 2012
+++ docs/articles/qntm.org/files/perl/perl.html	Sat Sep  1 04:42:07 2012
@@ -1599,7 +1599,7 @@
 <p><tt>BEGIN</tt>ブロックは常にさいs鬼実行されます。複数の<tt>BEGIN</tt>ブロックを書くと(don't)、 上から順番にコンパイラがそれらに出会う順番に実行されます。<tt>BEGIN</tt>ブロックは常に最初に実行されます。もし、BEGINブロックがスクリプトの途中(そんなことはしないでください)や、最後(or this)に書かれていたりしてさえも。</p>
 <p class="original">Because they are executed at compilation time, a <tt>BEGIN</tt> block placed inside a conditional block will <em>still</em> be executed first, even if the conditional evaluates to false and despite the fact that the conditional <em>has not been evaluated at all yet</em> and in fact <em>may never be evaluated</em>. <strong>Do not put <tt>BEGIN</tt> blocks in conditionals!</strong> If you want to do something conditionally at compile time, you need to put the conditional <em>inside</em> the <tt>BEGIN</tt> block:</p>
 <p>コンパイル時に実行されるので、<tt>BEGIN</tt>ブロックが条件ブロックの中にあっても、<em>まだ</em>最初に実行されます。たとえ、条件の評価が偽であり、条件が<em>まだまったく評価されていない</em>にもかかわらず、実際には、<em>評価されることがない</em>としてもです。
-<strong><tt>BEGIN</tt>ブロックを条件の中に置いては行けません!</strong> コンパイル時に何かしらの条件付きのことがしたければ、<tt>BEGIN</tt>ブロックの<em>中に<em>条件文を置かなければなりません:</p>
+<strong><tt>BEGIN</tt>ブロックを条件の中に置いては行けません!</strong> コンパイル時に何かしらの条件付きのことがしたければ、<tt>BEGIN</tt>ブロックの<em>中に</em>条件文を置かなければなりません:</p>
 <pre class="perl prettyprint">
 BEGIN {
 	if($condition) {
@@ -1691,23 +1691,41 @@
 crawl(); # "inch inch"
 </pre>
 
-<p>The package variable <tt>@EXPORT_OK</tt> can be populated with a list of all subroutines which the user can import explicitly by passing subroutine names to <tt>import()</tt>. If <tt>import()</tt> is called with the name of a subroutine not in this list, a runtime error will occur. For example, try <tt>use Bugs::Caterpillar ("pupate")</tt>.</p>
+<p class="original">The package variable <tt>@EXPORT_OK</tt> can be populated with a list of all subroutines which the user can import explicitly by passing subroutine names to <tt>import()</tt>. If <tt>import()</tt> is called with the name of a subroutine not in this list, a runtime error will occur. For example, try <tt>use Bugs::Caterpillar ("pupate")</tt>.</p>
 
-<p>The package variable <tt>@EXPORT</tt> can be populated with a list of subroutines to be exported by default. These are exported if <tt>import()</tt> is called with no arguments at all, which is what happens in this example.</p>
+<p>パッケージ変数<tt>@EXPORT</tt>はデフォルトでエクスポートされるサブルーチンのリストを入れます。<tt>import()</tt> が引数なしで呼ばれた場合に、この例で起きることが起きます。</p>
 
-<p>As a result of being <tt>import()</tt>ed, a method such as <tt>Bugs::Caterpillar::crawl()</tt> become available without qualification as <tt>crawl()</tt>. This saves typing. (Note: regardless of the content of <tt>@EXPORT_OK</tt>, every method can always be called "longhand", as shown above. There are no private methods in Perl. Customarily, a method intended for private use is named with a leading underscore or two.)</p>
+<p class=original>>As a result of being <tt>import()</tt>ed, a method such as <tt>Bugs::Caterpillar::crawl()</tt> become available without qualification as <tt>crawl()</tt>. This saves typing. (Note: regardless of the content of <tt>@EXPORT_OK</tt>, every method can always be called "longhand", as shown above. There are no private methods in Perl. Customarily, a method intended for private use is named with a leading underscore or two.)</p>
 
-<p><strong>A caution.</strong> Notice how <tt>crawl()</tt> was neither defined in the script, nor explicitly <tt>import()</tt>ed from another file with e.g. <tt>use Bugs::Caterpillar ("crawl")</tt>. Suppose the middle three lines weren't there to provide clues, and suppose there were a dozen <tt>use</tt> calls alongside <tt>use Bugs::Caterpillar</tt>. And remember that any module is free to have more <tt>use</tt> calls of its own. In such a situation, it is extremely difficult to locate the place where <tt>crawl()</tt> was originally defined. The moral of this story is twofold:</p>
-<ol>
+<p><tt>import()</tt>された結果として、<tt>Bugs::Caterpillar::crawl()</tt>のようなメソッドが<tt>crawl()</tt>のように、修飾なしに利用可能になります。これは、タイプ数の節約になります。(注意: <tt>@EXPORT_OK</tt>のコンセプトにかかわらず、 全てのメソッドは、上で見たように、"longhand"で呼ぶことが出来ます。 Perlにはプライベートメソッドはありません。通例、1つか2つのアンダースコアから始まる名前が付けられたメソッドはプライベートを意図します。</p>
+
+<p class="original"><strong>A caution.</strong> Notice how <tt>crawl()</tt> was neither defined in the script, nor explicitly <tt>import()</tt>ed from another file with e.g. <tt>use Bugs::Caterpillar ("crawl")</tt>. Suppose the middle three lines weren't there to provide clues, and suppose there were a dozen <tt>use</tt> calls alongside <tt>use Bugs::Caterpillar</tt>. And remember that any module is free to have more <tt>use</tt> calls of its own. In such a situation, it is extremely difficult to locate the place where <tt>crawl()</tt> was originally defined. The moral of this story is twofold:</p>
+
+<p><strong>注意。</strong><tt>crawl()</tt>はスクリプトで定義されておらず、明示的に他のファイルから<tt>import()</tt>されました。e.g. <tt>use Bugs::Caterpillar ("crawl")</tt>。真ん中の3行のようにヒントを提供せず、<tt>use Bugs::Caterpillar</tt>と並行して、12の<tt>use</tt>呼び出しがあったとすると。 また、どのモジュールも自由に複数の<tt>use</tt>呼び出しをそれ自身でできることを思い起こすと。このような状況では、
+<tt>crawl()</tt>が元々定義されている場所を見つけるのは容易ではありません。この話の教訓は2つあります:</p>
+
+<ol class="original">
 <li><p>When creating a module which makes use of Exporter, never use <tt>@EXPORT</tt> to export subroutines by default. Always make the user call subroutines "longhand" or <tt>import()</tt> them explicitly (using e.g. <tt>use Bugs::Caterpillar ("crawl")</tt>, which is a strong clue to look in <tt>Bugs/Caterpillar.pm</tt> for the definition of <tt>crawl()</tt>).</p></li>
 <li><p>When <tt>use</tt>ing a module, always explicitly name the subroutines you want to <tt>import()</tt>. If you don't want to <tt>import()</tt> any subroutines and wish to refer to them longhand, you must supply an explicit empty list: <tt>use Bugs::Caterpillar ()</tt>.</p></li>
 </ol>
 
-<h2>Files</h2>
+<ol class="original">
+<li><p>When creating a module which makes use of Exporter, never use <tt>@EXPORT</tt> to export subroutines by default. Always make the user call subroutines "longhand" or <tt>import()</tt> them explicitly (using e.g. <tt>use Bugs::Caterpillar ("crawl")</tt>, which is a strong clue to look in <tt>Bugs/Caterpillar.pm</tt> for the definition of <tt>crawl()</tt>).</p></li>
+<li><p>When <tt>use</tt>ing a module, always explicitly name the subroutines you want to <tt>import()</tt>. If you don't want to <tt>import()</tt> any subroutines and wish to refer to them longhand, you must supply an explicit empty list: <tt>use Bugs::Caterpillar ()</tt>.</p></li>
+</ol>
+<ol>
+<li><p>Exporterを使うモジュールを作る際には、デフォルトでサブルーチンをエクスポートする<tt>@EXPORT</tt>を使わないこと。常に、ユーザーに、"longhand"でサブルーチンを呼ばせるか、明示的に<tt>import()</tt>させること(e.g. <tt>use Bugs::Caterpillar ("crawl")</tt>を使って。<tt>Bugs/Caterpillar.pm</tt>に<tt>crawl()</tt>)の定義があるという強いヒントになります。</p></li>
+<li><p>モジュールを<tt>use</tt>すると、常に明示的に<tt>import()</tt>したいサブルーチンの名前書きます。何のサブルーチンも<tt>import()</tt>したくなく、longhandで参照したいのなら、からのリストを提供しなければいけません。: <tt>use Bugs::Caterpillar ()</tt>.</p></li>
+</ol>
+
+<h2 class="original">Files</h2>
+<h2>ファイル</h2>
 
-<p>A <i>file handle</i> is a completely different object from a scalar, array or hash variable. File handles are customarily represented in <tt>ALLCAPS</tt>; three familiar built-in filehandles are <tt>STDIN</tt>, <tt>STDOUT</tt> and <tt>STDERR</tt>.</p>
+<p class="original">A <i>file handle</i> is a completely different object from a scalar, array or hash variable. File handles are customarily represented in <tt>ALLCAPS</tt>; three familiar built-in filehandles are <tt>STDIN</tt>, <tt>STDOUT</tt> and <tt>STDERR</tt>.</p>
+<p><i>ファイルハンドル</i>は、スカラや配列やハッシュとは完全に違ったものです。ファイルハンドルは通例<tt>全て大文字</tt>で表現されます; 3つのよく知られている組込のファイルハンドルとして、<tt>STDIN</tt>, <tt>STDOUT</tt> and <tt>STDERR</tt>があります。</p>
 
-<p>Filehandles don't need declaring explicitly using <tt>my</tt> or <tt>our</tt>. They pop into existence automatically. A file handle can be opened using <tt>open</tt>. <tt>open</tt> must be supplied with a <i>method</i>. The method <tt>&lt;</tt> indicates that we wish to open the file to read from it:</p>
+<p class="original">Filehandles don't need declaring explicitly using <tt>my</tt> or <tt>our</tt>. They pop into existence automatically. A file handle can be opened using <tt>open</tt>. <tt>open</tt> must be supplied with a <i>method</i>. The method <tt>&lt;</tt> indicates that we wish to open the file to read from it:</p>
+<p>ファイルハンドルは<tt>my</tt>か<tt>our</tt>を使って、明示的に宣言する必要はありません。自動的にひょいと存在します。ファイルハンドルは<tt>open</tt>を使って開かれます。<tt>open</tt>は<i>方式</i>とともに、使われなければいけません。 方式は<tt>&lt;</tt> ファイルを読むために開くことを示します:</p>
 
 <pre class="perl prettyprint">
 my $f = "text.txt";
@@ -1718,23 +1736,28 @@
 }
 </pre>
 
-<p>As seen above, you should always check that the <tt>open</tt> operation completed successfully. If successful, <tt>open</tt> returns a true value. Otherwise, it returns <tt>undef</tt>. This checking procedure being rather tedious, a frequently-seen idiom is this:</p>
+<p class="original">As seen above, you should always check that the <tt>open</tt> operation completed successfully. If successful, <tt>open</tt> returns a true value. Otherwise, it returns <tt>undef</tt>. This checking procedure being rather tedious, a frequently-seen idiom is this:</p>
+<p>上のように、<tt>open</tt> 演算子が完全に成功したかを常にチェックすべきです。成功すれば<tt>open</tt>真を返します。そうでなければ、<tt>undef</tt>を返します。このチェックの手続きは退屈ですが、よくみかけるイディオムは次のものです:</p>
 <pre class="perl prettyprint">
 open(INPUT, "&lt;", $f) || die "Couldn't open ", $f, " for reading";
 </pre>
-<p>Notice how without the brackets, this would be:</p>
+<p class="original">Notice how without the brackets, this would be:</p>
+<p>ブラケットが無いとどうなるか注意してください。次のものは:</p>
 <pre class="perl prettyprint">
 open INPUT, "&lt;", $f || die "Couldn't open ", $f, " for reading";
 </pre>
-<p>Which is the same as the nonsensical:</p>
+<p class="original">Which is the same as the nonsensical:</p>
+<p>無意味なもの同じです:</p>
 <pre class="perl prettyprint">
 open INPUT, "&lt;", ($f || die "Couldn't open ", $f, " for reading");
 </pre>
-<p>For this reason (and, as far as I can tell, solely this reason), Perl provides a completely separate operator, <tt>or</tt>, which works exactly like <tt>||</tt> except that it has extremely low precedence, making this possible:</p>
+<p class="original">For this reason (and, as far as I can tell, solely this reason), Perl provides a completely separate operator, <tt>or</tt>, which works exactly like <tt>||</tt> except that it has extremely low precedence, making this possible:</p>
+<p>この理由で(教えられる限り、単にこの理由で)、Perlは完全に区別された演算子の<tt>or</tt>があります。<tt>||</tt>と同じですが、優先順位が非常に低いため、次のことが可能です:</p>
 <pre class="perl prettyprint">
 open INPUT, "&lt;", $f or die "Couldn't open ", $f, " for reading";
 </pre>
-<p>To read a line of text from a filehandle, use the <tt>readline</tt> built-in function. <tt>readline</tt> returns a full line of text, with a line break intact at the end of it (except possibly for the final line of the file), or <tt>undef</tt> if you've reached the end of the file.</p>
+<p class="original">To read a line of text from a filehandle, use the <tt>readline</tt> built-in function. <tt>readline</tt> returns a full line of text, with a line break intact at the end of it (except possibly for the final line of the file), or <tt>undef</tt> if you've reached the end of the file.</p>
+<p>ファイルハンドルからテキストの行を読むために、組込関数の<tt>readline</tt>を使えます。<tt>readline</tt>は、テキストの一行全体を、その終わりに改行をそのまま含んで返す(たぶんファイルの最終行を除いて)か、ファイルの最後に達すると<tt>undef</tt>を返します。</p>
 <pre class="perl prettyprint">
 while(1) {
 	my $line = readline INPUT;
@@ -1742,51 +1765,64 @@
 	# process the line...
 }
 </pre>
-<p>To truncate that possible trailing line break, use <tt>chomp</tt>:</p>
+<p class="original">To truncate that possible trailing line break, use <tt>chomp</tt>:</p>
+<p><tt>chomp</tt>を使うと改行を取り除けます:</p>
 <pre class="perl prettyprint">
 chomp $line;
 </pre>
-<p>Note that <tt>chomp</tt> acts on <tt>$line</tt> in place. <tt>$line = chomp $line</tt> is probably not what you want.</p>
-<p>You can also use <tt>eof</tt> to detect the end of the file:</p>
+<p class="original">Note that <tt>chomp</tt> acts on <tt>$line</tt> in place. <tt>$line = chomp $line</tt> is probably not what you want.</p>
+<p><tt>chomp</tt>は <tt>$line</tt>に対してその場で働きます。<tt>$line = chomp $line</tt>は多分お望みのもnoではないでしょう。</p>
+<p class="original">You can also use <tt>eof</tt> to detect the end of the file:</p>
+<p><tt>eof</tt>を使ってファイルの終端を判断することもできます:</p>
 <pre class="perl prettyprint">
 while(!eof INPUT) {
 	my $line = readline INPUT;
 	# process $line...
 }
 </pre>
-<p>But beware of just using <tt>while(my $line = readline INPUT)</tt>, because if <tt>$line</tt> turns out to be <tt>"0"</tt>, the loop will terminate early. If you want to write something like that, Perl provides the <tt>&lt;&gt;</tt> operator which wraps up <tt>readline</tt> in a fractionally safer way. This is very commonly-seen and perfectly safe:</p>
+<p class="original">But beware of just using <tt>while(my $line = readline INPUT)</tt>, because if <tt>$line</tt> turns out to be <tt>"0"</tt>, the loop will terminate early. If you want to write something like that, Perl provides the <tt>&lt;&gt;</tt> operator which wraps up <tt>readline</tt> in a fractionally safer way. This is very commonly-seen and perfectly safe:</p>
+<p>ですが、<tt>while(my $line = readline INPUT)</tt>を使うのは注意してください。<tt>$line</tt>が<tt>"0"</tt>で合った場合、ループは早くに終わってしまいます。そのように書きたいのならば、Perlには<tt>&lt;&gt;</tt>演算子があり、少し安全な方法で<tt>readline</tt>をラップしています。次のものは、とてもよくある完全に安全なものです:</p>
 <pre class="perl prettyprint">
 while(my $line = &lt;INPUT&gt;) {
 	# process $line...
 }
 </pre>
-<p>And even:</p>
+<p class="original">And even:</p>
+<p>次のようにさえ:</p>
 <pre class="perl prettyprint">
 while(&lt;INPUT&gt;) {
 	# process $_...
 }
 </pre>
-<p>To read a single line of user input:</p>
+<p class="original">To read a single line of user input:</p>
+<p>ユーザーの入力から一行読み出すには:</p>
 <pre class="perl prettyprint">
 my $line = &lt;STDIN&gt;;
 </pre>
-<p>To just wait for the user to hit Enter:</p>
+<p class="original">To just wait for the user to hit Enter:</p>
+<p>ユーザーがエンターを押すまで待つだけです:</p>
 <pre class="perl prettyprint">
 &lt;STDIN&gt;;
 </pre>
-<p>Calling <tt>&lt;&gt;</tt> with no filehandle reads data from standard input, or from any files named in arguments when the Perl script was called.</p>
-<p>Writing to a file involves first opening it in a different mode. The method <tt>&gt;</tt> indicates that we wish to open the file to write to it. (<tt>&gt;</tt> will clobber the content of the target file if it already exists and has content. To merely append to an existing file, use mode <tt>&gt;&gt;</tt>). Then, simply provide the filehandle as a zeroth argument for the <tt>print</tt> function.</p>
+<p class="original">Calling <tt>&lt;&gt;</tt> with no filehandle reads data from standard input, or from any files named in arguments when the Perl script was called.</p>
+<p><tt>&lt;&gt;</tt>をファイルハンドルなしで呼ぶと、標準入力からデータを読むか、Perlスクリプトが呼ばれた時の引数に渡された名前のファイルから読みます。</p>
+<p class="original">Writing to a file involves first opening it in a different mode. The method <tt>&gt;</tt> indicates that we wish to open the file to write to it. (<tt>&gt;</tt> will clobber the content of the target file if it already exists and has content. To merely append to an existing file, use mode <tt>&gt;&gt;</tt>). Then, simply provide the filehandle as a zeroth argument for the <tt>print</tt> function.</p>
+<p>ファイルに書き込む場合は、違ったモードで最初に開きます。方式<tt>&gt;</tt>は、書き込み用にファイルを開くことを指示します。(<tt>&gt;</tt>は、目的のファイルの中身をこ合します。単純に、追加したい場合は、<tt>&gt;&gt;</tt>のモードを使います)。それから、
+<tt>print</tt>関数の0番目の引数として、ファイルハンドルを単に渡します。</p>
 <pre class="perl prettyprint">
 open OUTPUT, "&gt;", $f or die "Couldn't open ", $f, " for writing";
 print OUTPUT "The eagles have left the nest";
 </pre>
-<p>Notice the absence of a comma between the filehandle and the first argument in <tt>print</tt>. As you've gathered, if the filehandle is omitted, <tt>STDOUT</tt> is used by default.</p>
-<p>File handles are actually closed automatically at script exit time, but otherwise:</p>
+<p class="original">Notice the absence of a comma between the filehandle and the first argument in <tt>print</tt>. As you've gathered, if the filehandle is omitted, <tt>STDOUT</tt> is used by default.</p>
+<p><tt>print</tt>でファイルハンドルと最初の引数の間にカンマがないことに気をつけてください。既に知っているとおり、ファイルハンドルが省略された場合は、<tt>STDOUT</tt>がデフォルトで使われます。</p>
+<p class=original>File handles are actually closed automatically at script exit time, but otherwise:</p>
+<p>ファイルハンドルは実際にはスクリプトが終わるときに自動的に閉じられます。そうでなければ:</p>
 <pre class="perl prettyprint">
 close INPUT;
 close OUTPUT;
 </pre>
-<p>A scalar variable may hold a reference to a file handle instead of a variable:</p>
+<p class="original">A scalar variable may hold a reference to a file handle instead of a variable:</p>
+<p>スカラ変数で、変数の代わりにファイルハンドルのリファレンスを持ってもよいです:</p>
 <pre class="perl prettyprint">
 my $fh;
 open $fh, "&lt;", "text.txt" or die;
@@ -1795,22 +1831,30 @@
 }
 close $fh;
 </pre>
-<h2>System calls</h2>
-<p>Apologies if you already know the following non-Perl-related facts. Every time a process finishes on a Windows or Linux system (and, I assume, on most other systems), it concludes with a 16-bit <i>status word</i>. The highest 8 bits constitute a <i>return code</i> between 0 and 255 inclusive, with 0 conventionally representing unqualified success, and other values representing various degrees of failure. The other 8 bits are less frequently examined - they "reflect mode of failure, like signal death and core dump information".</p>
-<p>You can exit from a Perl script with the return code of your choice (from 0 to 255) using <tt>exit</tt>.</p>
-<p>Perl provides More Than One Way To - in a single call - spawn a child process, pause the current script until the child process has finished, and then resume interpretation of the current script. Whichever method is used, you will find that immediately afterwards, the built-in variable <tt>$?</tt> (<tt>$CHILD_ERROR</tt>) has been populated with the status word that was returned from that child process's termination. You can get the return code by taking just the highest 8 of those 16 bits: <tt>$? >> 8</tt>.</p>
-<p>The <tt>system</tt> function can be used to invoke another program with the arguments listed. The value returned by <tt>system</tt> is the same value with which <tt>$?</tt> is populated:</p>
+<h2 class="original">System calls</h2>
+<h2>システムコール</h2>
+<p class="original">Apologies if you already know the following non-Perl-related facts. Every time a process finishes on a Windows or Linux system (and, I assume, on most other systems), it concludes with a 16-bit <i>status word</i>. The highest 8 bits constitute a <i>return code</i> between 0 and 255 inclusive, with 0 conventionally representing unqualified success, and other values representing various degrees of failure. The other 8 bits are less frequently examined - they "reflect mode of failure, like signal death and core dump information".</p>
+<p>既に以下のPerlと関係ない事実をご存知でしたら申し訳有りません。WindowやLinux(また、多くの他のシステムでも同様と想定されますがが)のシステムではプロセスが終わるたびに、16ビットの<i>状態ワード</i>で終了します。上位の8ビットは0〜255の間を含む<i>リターンコード</i>を構成します。0は慣例的に、無条件で成功したことを示します。他の値は様々な度合いの失敗を示します。他の8ビットはあまりよく調べられませんが、それらは"シグナルの死亡やコアダンプの情報のような失敗のモードを反映します"。</p>
+<p class="original">You can exit from a Perl script with the return code of your choice (from 0 to 255) using <tt>exit</tt>.</p>
+<p>Perlから終了する際に、<tt>exit</tt>を使って(0から255までの)好きなリターンコードを返せます。</p>
+<p class="original">Perl provides More Than One Way To - in a single call - spawn a child process, pause the current script until the child process has finished, and then resume interpretation of the current script. Whichever method is used, you will find that immediately afterwards, the built-in variable <tt>$?</tt> (<tt>$CHILD_ERROR</tt>) has been populated with the status word that was returned from that child process's termination. You can get the return code by taking just the highest 8 of those 16 bits: <tt>$? >> 8</tt>.</p>
+<p>Perlには一つより多くの - 子プロセスを産む - 方法があります。現在のスクリプトを止め、子プロセスが終わったら、現在のスクリプトの解釈を続けます。
+どの方法を使っても、その直後で、子プロセスの終了時に返された状態ワードが入っている、組込の変数<tt>$?</tt>(<tt>$CHILD_ERROR</tt>)を見つけられます。16ビットの上位8を取ることで、リターンコードを得ることができます: <tt>$? >> 8</tt>。</p>
+<p class="original">The <tt>system</tt> function can be used to invoke another program with the arguments listed. The value returned by <tt>system</tt> is the same value with which <tt>$?</tt> is populated:</p>
+<p><tt>system</tt>関数は他のプログラムを引数のリストと一緒に呼び出せます。<tt>system</tt>によって返される値は、<tt>$?</tt>に入るのと同じ値です:</p>
 <pre class="perl prettyprint">
 my $rc = system "perl", "anotherscript.pl", "foo", "bar", "baz";
 $rc >>= 8;
 print $rc; # "37";
 </pre>
-<p>Alternatively, you can use backticks <tt>``</tt> to run an actual command at the command line and capture the standard output from that command. In scalar context the entire output is returned as a single string. In list context, the entire output is returned as an array of strings, each one representing a line of output.</p>
+<p class="original">Alternatively, you can use backticks <tt>``</tt> to run an actual command at the command line and capture the standard output from that command. In scalar context the entire output is returned as a single string. In list context, the entire output is returned as an array of strings, each one representing a line of output.</p>
+<p>代わりに、バッククォート<tt>``</tt>を使って、コマンドラインで実際のコマンドを走らせて、コマンドからの標準出力をキャプチャできます。スカラコンテキストでは、全ての出力は単一の文字列として帰ります。リストコンテキストでは、全ての出力は一行ずつの文字列の配列として返されます。</p>
 <pre class="perl prettyprint">
 my $text = `perl anotherscript.pl foo bar baz`;
 print $text; # "foobarbaz"
 </pre>
-<p>This is the behaviour which would be seen if <tt>anotherscript.pl</tt> contained, for example:</p>
+<p class="original">This is the behaviour which would be seen if <tt>anotherscript.pl</tt> contained, for example:</p>
+<p>これは、<tt>anotherscript.pl</tt>が含んでいたら、見られる振る舞いです。例:</p>
 <pre class="perl prettyprint">
 use strict;
 use warnings;
@@ -1819,9 +1863,11 @@
 exit(37);
 </pre>
 
-<h2>Miscellaneous notes</h2>
-<p>Perl provides a wide selection of quote-like operators in addition to what you've seen in these documents:</p>
-<ul>
+<h2 class="original">Miscellaneous notes</h2>
+<h2>その他の注意</h2>
+<p class="original">Perl provides a wide selection of quote-like operators in addition to what you've seen in these documents:</p>
+<p>Perlはクォートの代わりをする演算子の、すでにこのドキュメント内で見ているものに加えて、多くの選択肢を提供しています:</p>
+<ul class="original">
 	<li>
 		<p>There's an alternate syntax, <tt>qw{ }</tt>, for declaring arrays. This often seen in <tt>use</tt> statements:</p>
 <pre class="perl prettyprint">
@@ -1846,13 +1892,43 @@
 		<p>And many more!</p>
 	</li>
 </ul>
-<p>Instead of braces, you can use any character you like as the delimiter in these alternate quote-like operators, as well as in <tt>m//</tt> regex matches and <tt>s///</tt> regex replacements. This is actually quite useful if your regex contains a lot of slashes or backslashes. For example, <tt>m!///!</tt> matches three literal forward slashes.</p>
-<p>Perl does have <tt>CONSTANTS</tt>. These are discouraged now, but weren't always. Constants are actually just subroutine calls with omitted brackets.</p>
-<p>Sometimes people omit quotes around hash keys. They can get away with it because in this situation a bareword (a string with no sigil) occurs as a string, as opposed to a subroutine call or a filehandle or a package name.</p>
-<p>If you see a block of unformatted code wrapped in a delimiter with double chevrons, like <tt>&lt;&lt;EOF</tt>, the magic word to Google for is "heredoc".</p>
-<p>The Data::Dumper module can be used to output an arbitrary scalar variable to the screen. This is an essential debug tool.</p>
-
-<p>Warning! Many built-in functions can be called with no arguments, <strong>causing them to operate on <tt>$_</tt> instead</strong>. Hopefully this will help you understand formations like:</p>
+<ul>
+	<li>
+		<p>代わりのシンタックスとして、<tt>qw{ }</tt>が、配列の宣言のためにあります。<tt>use</tt>ステートメントでよく見られます:</p>
+<pre class="perl prettyprint">
+use Account qw{create open close suspend delete};
+</pre>
+	</li>
+	<li>
+		<p><tt>qr//</tt>は正規表現をスカラ変数に置くのに使われます。これは非常に便利です。なぜなら、正規表現の再コンパイルには時間がかかるからです:</p>
+<pre class="perl prettyprint">
+my @capitals = ("Baton Rouge", "Indianapolis", "Columbus", "Montgomery", "Helena", "Denver", "Boise");
+my $regex = qr/^[B-H]/;
+print join ", ", grep /$regex/, @capitals;
+</pre>
+	</li>
+	<li>
+		<p><tt>qx{ }</tt>は `バッククォート`の代わりに使われます。 プログラムを実行し、その出力をキャプチャします:</p>
+<pre class="perl prettyprint">
+my $text = qx{perl anotherscript.pl foo bar baz};
+</pre>
+	</li>
+	<li>
+		<p>さらにもっと!</p>
+	</li>
+</ul>
+<p class="original">Instead of braces, you can use any character you like as the delimiter in these alternate quote-like operators, as well as in <tt>m//</tt> regex matches and <tt>s///</tt> regex replacements. This is actually quite useful if your regex contains a lot of slashes or backslashes. For example, <tt>m!///!</tt> matches three literal forward slashes.</p>
+<p>ブレースの代わりに、クォートの代わりの演算子はどのような文字でも区切りとして使えます。ちょうど<tt>m//</tt>正規表現のマッチや<tt>s///</tt>正規表現の置換と同様です。これは、正規表現が多くのスラッシュやバックスラッシュを含む場合に、非常に有用です。例えば、<tt>m!///!</tt>は、全貌の3文字のスラッシュにマッチします。</p>
+<p class="original">Perl does have <tt>CONSTANTS</tt>. These are discouraged now, but weren't always. Constants are actually just subroutine calls with omitted brackets.</p>
+<p>Perlには<tt>定数</tt>があります。 気落ちするようなものですが、常にではありません。定数は実際には、ブラケットを省略したただのサブルーチン呼び出しです。</p>
+<p class="original">Sometimes people omit quotes around hash keys. They can get away with it because in this situation a bareword (a string with no sigil) occurs as a string, as opposed to a subroutine call or a filehandle or a package name.</p>
+<p>時々、ハッシュのキーでクォートを省略されていますが、この状況では、裸のワード(シジルのない文字列)は、サブルーチン呼び出しやファイルハンドルやパッケージ名ではなく、文字列になるからです。</p>
+<p class="original">If you see a block of unformatted code wrapped in a delimiter with double chevrons, like <tt>&lt;&lt;EOF</tt>, the magic word to Google for is "heredoc".</p>
+<p><tt>&lt;&lt;EOF</tt>のように、2つの山括弧で区切られてラップされた整理されていないコードのブロックを見たら、Google検索のためのマジックワードは"ヒアドキュメント"です。</p>
+<p class="original">The Data::Dumper module can be used to output an arbitrary scalar variable to the screen. This is an essential debug tool.</p>
+<p>Data::Dumperモジュールは任意のスカラの値をスクリーンに出力するのに使えます。これは基本的なデバッグツールです。</p>
+<p class="original">Warning! Many built-in functions can be called with no arguments, <strong>causing them to operate on <tt>$_</tt> instead</strong>. Hopefully this will help you understand formations like:</p>
+<p>注意! 多くの組込関数では、引数なしで呼ぶと<strong><tt>$_</tt>が代わりに渡されます</strong>。願わくば、次のような形を理解する助けになれば良いのですが:</p>
 <pre class="perl prettyprint">
 print foreach @array;
 
@@ -1860,8 +1936,8 @@
 	next unless defined;
 }
 </pre>
-<p>I dislike this formation because it can lead to problems when refactoring.</p>
-
+<p class="original">I dislike this formation because it can lead to problems when refactoring.</p>
+<p>私は、この形は嫌いです。リファクタリングの際に、問題を起こすことがあるからです。</p>
 
 <h3 class=original>File tests</h3>
 <h3>ファイルテスト</h3>



perldocjp-cvs メーリングリストの案内
Back to archive index