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

Back to archive index

ktats****@users***** ktats****@users*****
2012年 9月 2日 (日) 15:43:14 JST


Index: docs/articles/qntm.org/files/perl/perl.html
diff -u docs/articles/qntm.org/files/perl/perl.html:1.10 docs/articles/qntm.org/files/perl/perl.html:1.11
--- docs/articles/qntm.org/files/perl/perl.html:1.10	Sun Sep  2 01:47:32 2012
+++ docs/articles/qntm.org/files/perl/perl.html	Sun Sep  2 15:43:13 2012
@@ -26,10 +26,10 @@
 
 <p class="original">Perl is a dynamic, dynamically-typed, high-level, scripting (interpreted) language most comparable with PHP and Python. Perl's syntax owes a lot to ancient shell scripting tools, and it is famed for its overuse of confusing symbols, the majority of which are impossible to Google for. Perl's shell scripting heritage makes it great for writing <i>glue code</i>: scripts which link together other scripts and programs. Perl is ideally suited for processing text data and producing more text data. Perl is widespread, popular, highly portable and well-supported. Perl was designed with the philosophy "There's More Than One Way To Do It" (TMTOWTDI) (contrast with Python, where "there should be one - and preferably only one - obvious way to do it").</p>
 
-<p>Perlは動的な、動的型付けの、高級な、スクリプト(インタープリタで解釈される)言語で、PHPã‚„Pythonとともによく比較されます。Perlのシンタックスは、昔のshellスクリプトツールから多くの部分を借りており、それにより混乱させるシンボルを使い過ぎていることで有名です。それらの大多数をGoogleで検索することは不可能です。Perlのshellスクリプトから受け継いだ遺産は、<i>glueコード</i>(他のスクリプトやプログラムと一緒にリンクされているスクリプト)を書くのに、大変役に立ちます。Perlは、理想的にテキストデータを処理することや、テキストデータを生み出すことに適しています。Perlは広く行き渡り、有名であり、極めてポータブルで、十分にサポートされています。Perlは"There's More Than One Way To Do It(やり方はひとつじゃなã
 „)" (TMTOWTDI)の哲学でデザインされました(Pythonと比較すると、"there should be one - and preferably only one - obvious way to do it(明らかなやり方は、ひとつであるべきであり、むしろひとつのみであるべき)")。</p>
+<p>Perlは動的な、動的型付けの、高級な、スクリプト(インタープリタで解釈される)言語で、PHPやPythonとともによく比較されます。Perlのシンタックスは、昔のshellスクリプトツールから多くの部分を借りており、それにより混乱させるシンボルを使い過ぎていることで有名です。それらの大多数をGoogleで検索することは不可能です。Perlのshellスクリプトから受け継いだ遺産は、<i>glueコード</i>(他のスクリプトやプログラムと一緒にリンクされているスクリプト)を書くのに、大変役に立ちます。Perlは、理想的にテキストデータを処理することや、テキストデータを生成するのに適しています。Perlは広く行き渡り、有名であり、極めてポータブルで、十分にサポートされています。Perlは"There's More Than One Way To Do It(やり方はひとつじゃない)
 " (TMTOWTDI)の哲学でデザインされました(Pythonと比較すると、"there should be one - and preferably only one - obvious way to do it(明らかなやり方は、ひとつであるべきであり、むしろひとつのみであるべき)")。</p>
 
 <p class=original>Perl has horrors, but it also has some great redeeming features. In this respect it is like every other programming language ever created.</p>
-<p>Perlには恐ろしいところがありますが、それを補って余りあるところもあります。その点で、今までに作られた全ての他のプログラミング言語と同じです。</p>
+<p>Perlには恐ろしいところがありますが、それを補って余りある良さもあります。その点で、今までに作られた全ての他のプログラミング言語と同じです。</p>
 <p class=original>This document is intended to be informative, not evangelical. It is aimed at people who, like me:</p>
 <p>このドキュメントは、情報を与えることを意図しており、熱心に普及させるものではありません。以下のような、私のような人向けのものです:</p>
 <ul class=original>
@@ -42,8 +42,8 @@
 
 <ul>
 	<li>技術的過ぎて、一般的ではないエッジケースに多くの部分を割いている<a href="http://perl.org">http://perl.org/</a>にある、公式のPerlのドキュメントが嫌い</li>
-	<li>"原理と例"でさっさと学びたい</li>
-	<li>Larry Wallにはっきり言ってほしい</li>
+	<li>"原理と例"で新しいプログラミング言語さっさと学びたい</li>
+	<li>Larry Wallにはっきり言ってほしいと思っている</li>
 	<li>一般的な用語でプログラムすることをすでに知っている</li>
 	<li>仕事を終えるために何が必要かということ以上のことをPerlについて気にしない</li>
 </ul>
@@ -56,7 +56,7 @@
 <h2>前書き</h2>
 <ul class=original>
 <li><p class="original">The following can be said of almost every declarative statement in this document: "that's not, strictly speaking, true; the situation is actually a lot more complicated".  If you see a serious lie, point it out, but I reserve the right to preserve certain critical lies-to-children.</p>
-<p>以下のことを、このドキュメント内のほとんどすべての宣言文で言うことが出来ます: "これは、厳格な意味での、真実ではありません; 状況は実際にはもっと複雑です"。私は故意に問題の"完全な真実"をわざわざ調べることを、省略したり、無視していますが、それは、アインシュタインの場の方程式で7年生の物理学の学生を始めるのに意味がないのと同じ理由です。もし深刻な嘘を見つけたら、指摘してください。ですが、私には子どもにつく重要な嘘をそのままにしておく権利があります。</p></li>
+<p>以下のことを、このドキュメント内のほとんどすべての宣言文で言うことが出来ます: "これは、厳格な意味での、真実ではありません; 状況は実際にはもっと複雑です"。もし深刻な嘘を見つけたら、指摘してください。ですが、私には子どもにつく重要な嘘をそのままにしておく権利があります。</p></li>
 <li><p class="original">Throughout this document I'm using example <code>print</code> statements to output data but not explicitly appending line breaks. This is done to prevent me from going crazy and to give greater attention to the actual string being printed in each case, which is invariably more important. In many examples, this results in alotofwordsallsmusheduptogetherononeline if the code is run in reality. Try to ignore this. </p>
 <p>このドキュメントを通して、例において<code>print</code>ステートメントをデータを出力するために使っていますが、明示的に改行を追加していません。これは、私を気違いにさせないためであり、それぞれのケースで出力される、より重要な実際の文字列に多くの注意を向けさせるためです。多くの例で、実際にコードを動かすと、alotofwordsallsmusheduptogetherononelineのような結果になります。無視してください。</p></li>
 </ul>
@@ -107,7 +107,7 @@
 	<li>a string</li>
 	<li>a reference to any other variable.</li>
 </ul>
-<ul class=original>
+<ul>
 	<li><code>undef</code> (Pythonにおける<code>None</code>、PHPの<code>null</code>に対応)</li>
 	<li>数字 (Perlはintegerとfloatを区別しません)</li>
 	<li>文字</li>
@@ -179,7 +179,7 @@
 <p class=original>The lesson is to always using the correct operator in the correct situation. There are separate operators for comparing scalars as numbers and comparing scalars as strings:</p>
 <p>このレッスンでは、正しい状況で正しい演算子を使うようにしています。数字としてスカラを比較するのと、文字列としてスカラを比較するのとでは、演算子を区別します。:</p>
 
-<pre class="perl prettyprint">
+<pre class="perl original">
 # Numerical operators:  &lt;,  &gt;, &lt;=, &gt;=, ==, !=, &lt;=&gt;, +, *
 # String operators:    <a href="http://perldoc.perl.org/perlop.html#Equality-Operators">lt, gt, le, ge, eq, ne, cmp</a>, <a href="http://perldoc.perl.org/perlop.html#Multiplicative-Operators">.</a>, <a href="http://perldoc.perl.org/perlop.html#Multiplicative-Operators">x</a>
 </pre>
@@ -689,10 +689,9 @@
 <h3 class="original">Getting information out of a data structure</h3>
 <h3>データ構造から情報を取り出す</h3>
 
-<p class="original">Now, let's assume that you still have <code>%account</code> kicking around but everything else (if there was anything else) has fallen out of scope. You can print the information out by reversing the same procedure in each case. Again, here are
-four examples, of which the last is the most useful:</p>
+<p class="original">Now, let's assume that you still have <code>%account</code> kicking around but everything else (if there was anything else) has fallen out of scope. You can print the information out by reversing the same procedure in each case. Again, here are four examples, of which the last is the most useful:</p>
 
-<p>さて、いじくりまわす<code>%account</code>がまだあるとしましょう。ですが、全ての他のもの(他のものがあったなら)は、スコープの外に落ちます。それぞれのケースで同じ手順を逆向きにすることで、情報を表示できます。もう一度、4つの例がありますが、最後のものが一番有用です。</p>
+<p>さて、いじくりまわすために<code>%account</code>がまだあるとしましょう。ですが、全ての他のもの(他のものがあったなら)は、スコープの外に落ちます。それぞれのケースで同じ手順を逆向きにすることで、情報を表示できます。もう一度、4つの例がありますが、最後のものが一番有用です。</p>
 
 <pre class="perl prettyprint">
 my $ownersRef = $account{"owners"};
@@ -751,21 +750,21 @@
 <h3>配列のリファレンスで自分で自分の足を撃つ方法</h3>
 
 <p class=original>This array has five elements:</p>
-<p>この配列には5つの要素があります:</p>
+<p>次の配列には5つの要素があります:</p>
 <pre class="perl prettyprint">
 my @array1 = (1, 2, 3, 4, 5);
 print @array1; # "12345"
 </pre>
 
 <p class=original>This array, however, has ONE element (which happens to be a reference to an anonymous, five-element array):</p>
-<p>この配列にはひとつの要素(無名の5つの要素の配列のリファレンス)があります:</p>
+<p>しかし、次の配列には*ひとつ*の要素(無名の5つの要素の配列のリファレンス)があります:</p>
 <pre class="perl prettyprint">
 my @array2 = [1, 2, 3, 4, 5];
 print @array2; # e.g. "ARRAY(0x182c180)"
 </pre>
 
 <p class=original>This <em>scalar</em> is a reference to an anonymous, five-element array:</p>
-<p>この <em>スカラ</em> は、無名の5つの要素の配列のリファレンスになります:</p>
+<p>次の <em>スカラ</em> は、無名の5つの要素の配列のリファレンスになります:</p>
 <pre class="perl prettyprint">
 my $array3Ref = [1, 2, 3, 4, 5];
 print $array3Ref;      # e.g. "ARRAY(0x22710c0)"
@@ -853,7 +852,7 @@
 </pre>
 
 <p class=original><code>if</code> statements evaluate their conditions in scalar context. For example, <code>if(@array)</code> returns true if and only if <code>@array</code> has 1 or more elements. It doesn't matter what those elements are - they may contain <code>undef</code> or other false values for all we care.</p>
-<p><code>if/code>文では、これらの条件がはスカラコンテキストで価されます。<code>if(@array)</code>は、<code>@array</code>にひとつ以上のエレメントがある場合のみ、真となります。配列の中の値が何かは問題にしません - 全てが<code>undef</code>や他の偽の値でも</p>
+<p><code>if</code>文では、これらの条件がはスカラコンテキストで価されます。<code>if(@array)</code>は、<code>@array</code>にひとつ以上のエレメントがある場合のみ、真となります。配列の中の値が何かは問題にしません - 全てが<code>undef</code>や他の偽の値でも</p>
 
 <h2 class=original>Loops</h2>
 <h2>ループ</h2>
@@ -883,7 +882,7 @@
 </pre>
 
 <p class="original">These <code>do</code> loops are <em>almost</em> equivalent (a warning would be raised if <code>@array</code> were empty):</p>
-<p>これらの<code>do</code>ループは、<em>ほとんど</em>同じです(<code>@array</code>が空の場合警告が起きます):</p>
+<p>これらの<code>do</code>ループは、<em>ほとんど</em>同じです<!-- (<code>@array</code>が空の場合警告が起きます) -->:</p>
 
 <pre class="perl prettyprint">
 my $i = 0;
@@ -967,7 +966,7 @@
 
 <p class=original><code>next</code> and <code>last</code> can be used to control the progress of a loop. In most programming languages these are known as <code>continue</code> and <code>break</code> respectively. We can also optionally provide a label for any loop. By convention, labels are written in <code>ALLCAPITALS</code>. Having labelled the loop, <code>next</code> and <code>last</code> may target that label. This example finds primes below 100:</p>
 
-<p><code>next</code> と <code>last</code>はループ進みを制御するのに使われます。多くのプログラミング言語では、それぞれ、<code>continue</code> と <code>break</code>となっています。オプションで、どのループにもラベルをつけることができます。慣例により、ラベルは <code>全て大文字で</code>書くことになっています。ループにラベルをつけることで、<code>next</code> と <code>last</code> にラベルを対象にできます。100未満の素数を見つける例です:</p>
+<p><code>next</code> と <code>last</code>はループ進みを制御するのに使われます。多くのプログラミング言語では、それぞれ、<code>continue</code> と <code>break</code>となっています。オプションで、どのループにもラベルをつけることができます。慣例により、ラベルは<code>全て大文字で</code>書くことになっています。ループにラベルをつけることで、<code>next</code> と <code>last</code> にラベルを対象にできます。100以下の素数を見つける例です:</p>
 
 <pre class="perl prettyprint">
 CANDIDATE: for my $candidate ( 3 .. 100 ) {
@@ -1054,7 +1053,7 @@
 </pre>
 
 <p class=original>The <code><a href="http://perldoc.perl.org/functions/map.html">map</a></code> function takes an array as input and applies an operation to every scalar <code>$_</code> in this array. It then constructs a new array out of the results. The operation to perform is provided in the form of a single expression inside braces:</p>
-<p><code>map</code>関数は入力として配列をとり、配列内の全てのスカラ <code>$_</code>を操作します。結果として新しい配列を作ります。操作はひとつのブレースで渡します::</p>
+<p><code>map</code>関数は入力として配列をとり、配列内の全てのスカラ <code>$_</code>を操作します。結果として新しい配列を作ります。操作はひとつのブレースで渡します:</p>
 
 <pre class="perl prettyprint">
 my @capitals = ("Baton Rouge", "Indianapolis", "Columbus", "Montgomery", "Helena", "Denver", "Boise");
@@ -1148,7 +1147,6 @@
 <ul>
 	<li>たくさんある</li>
 	<li>とても便利</li>
-	<li>are </li>
 	<li><a href="http://perldoc.perl.org/perlfunc.html">広くドキュント化</a>されている</li>
 	<li>シンタックスで大きく異なるので、ドキュメントを見ること</li>
 	<li>引数として正規表現を受け付けるものもある</li>
@@ -1303,11 +1301,11 @@
 <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>既に以下の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 <code><a href="http://perldoc.perl.org/functions/exit.html">exit</a></code>.</p>
 <p>Perlから終了する際に、<code><a href="http://perldoc.perl.org/functions/exit.html">exit</a></code>を使って(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 <a href="http://perldoc.perl.org/perlvar.html">built-in scalar variable</a> <code>$?</code> 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: <code>$? >> 8</code>.</p>
-<p>Perlには一つ以上の - 子プロセスを産む - 方法があります。現在のスクリプトを止め、子プロセスが終わったら、現在のスクリプトの解釈を続けます。どの方法を使っても、その直後で、子プロセスの終了時に返された状態ワードが入っている、<a href="http://perldoc.perl.org/perlvar.html">組込のスカラ変数</a>の<code>$?</code>に入ります。返された値の16ビットの上位8を取ることで、リターンコードを得ることができます: <code>$? >> 8</code>。</p>
+<p>Perlには一つ以上の - 子プロセスを産む - 方法があります。現在のスクリプトを止め、子プロセスが終わったら、現在のスクリプトの解釈を続けます。どの方法を使っても、その直後で、子プロセスの終了時に返された状態ワードが<a href="http://perldoc.perl.org/perlvar.html">組込のスカラ変数</a>の<code>$?</code>に入ります。返された値の16ビットの上位8を取ることで、リターンコードを得ることができます: <code>$? >> 8</code>。</p>
 <p class="original">The <code>system</code> function can be used to invoke another program with the arguments listed. The value returned by <code>system</code> is the same value with which <code>$?</code> is populated:</p>
 <p><code>system</code>関数は他のプログラムを引数のリストと一緒に呼び出せます。<code>system</code>によって返される値は、<code>$?</code>に入るのと同じ値です:</p>
 <pre class="perl prettyprint">
@@ -1338,7 +1336,7 @@
 <p>スカラ変数は、数字/文字列/リファレンスや<code>undef</code>の代わりに<i>ファイルハンドル</i>も持てます。ファイルハンドルは基本的に特定のファイルの特定の場所を示すリファレンスです。</p>
 
 <p class=original>Use <code><a href="http://perldoc.perl.org/functions/open.html">open</a></code> to turn a scalar variable into a file handle. <code>open</code> must be supplied with a <i>mode</i>. The mode <code>&lt;</code> indicates that we wish to open the file to read from it:</p>
-<p><code><a href="http://perldoc.perl.org/functions/open.html">open</a></code>を使って、スカラ変数をファイルハンドルにします。<code>open</code>は<i>モード</i>とともに使われなければいけません。モード<code>&lt;</code>は、ファイルから読み出したいことを意図します:</p>
+<p><code><a href="http://perldoc.perl.org/functions/open.html">open</a></code>を使って、スカラ変数をファイルハンドルにします。<code>open</code>は<i>モード</i>とともに使われなければいけません。モード <code>&lt;</code> は、ファイルから読み出したいことを意図します:</p>
 
 <pre class="perl prettyprint">
 my $f = "text.txt";
@@ -1350,7 +1348,7 @@
 </pre>
 
 <p class="original">As seen above, you should always check that the <code>open</code> operation completed successfully. If successful, <code>open</code> returns a true value. Otherwise, it returns false and an error message is stuffed into the built-in variable <code>$!</code>. This checking being rather tedious, a common idiom is:</p>
-<p>上のように、<code>open</code> 演算子が完全に成功したかを常にチェックすべきです。成功すれば<code>open</code>真を返します。そうでなければ、<code>undef</code>を返します。このチェックの手続きは退屈ですが、よくみかけるイディオムは次のものです:</p>
+<p>上のように、<code>open</code> 演算子が完全に成功したかを常にチェックすべきです。成功すれば<code>open</code>は真を返します。そうでなければ、<code>undef</code>を返します。このチェックの手続きは退屈ですが、よくみかけるイディオムは次のものです:</p>
 
 <pre class="perl prettyprint">
 open(my $fh, "&lt;", $f) || die "Couldn't open '".$f."' for reading because: ".$!;
@@ -1374,7 +1372,7 @@
 chomp $line;
 </pre>
 <p class="original">Note that <code>chomp</code> acts on <code>$line</code> in place. <code>$line = chomp $line</code> is probably not what you want.</p>
-<p><code>chomp</code>は <code>$line</code>に対してその場で働きます。<code>$line = chomp $line</code>は多分お望みのもnoではないでしょう。</p>
+<p><code>chomp</code>は <code>$line</code>に対してその場で働きます。<code>$line = chomp $line</code>は多分お望みのものではないでしょう。</p>
 
 <p class="original">You can also use <code><a href="http://perldoc.perl.org/functions/eof.html">eof</a></code> to detect that the end of the file has been reached:</p>
 <p><code><a href="http://perldoc.perl.org/functions/eof.html">eof</a></code>を使ってファイルの終端を判断することもできます:</p>
@@ -1400,7 +1398,7 @@
 }
 </pre>
 <p class="original">Writing to a file involves first opening it in a different mode. The mode <code>&gt;</code> indicates that we wish to open the file to write to it. (<code>&gt;</code> will clobber the content of the target file if it already exists and has content. To merely append to an existing file, use mode <code>&gt;&gt;</code>). Then, simply provide the filehandle as a zeroth argument for the <code>print</code> function.</p>
-<p>ファイルに書き込む場合は、違ったモードで最初に開きます。モード<code>&gt;</code>は、書き込み用にファイルを開くことを指示します。(<code>&gt;</code>は、目的のファイルの中身をこ合します。単純に、追加したい場合は、<code>&gt;&gt;</code>のモードを使います)。それから、<code>print</code>関数の0番目の引数として、ファイルハンドルを単に渡します。</p>
+<p>ファイルに書き込む場合は、違ったモードで最初に開きます。モード <code>&gt;</code> は、書き込み用にファイルを開くことを指示します。(<code>&gt;</code>は、目的のファイルの中身を壊します。単純に、追加したい場合は、<code>&gt;&gt;</code> のモードを使います)。それから、<code>print</code>関数の0番目の引数として、ファイルハンドルを単に渡します。</p>
 <pre class="perl prettyprint">
 open(my $fh2, "&gt;", $f) || die "Couldn't open '".$f."' for writing because: ".$!;
 print $fh2 "The eagles have left the nest";
@@ -1409,7 +1407,7 @@
 <p><code>print</code>で<code>$fh2</code>と次の引数の間にカンマがないことに気をつけてください。</p>
 
 <p class=original>File handles are actually closed automatically when they drop out of scope, but otherwise:</p>
-<p>ファイルハンドルはスコープを抜けると自動的に閉じられます。もしくは:</p>
+<p>ファイルハンドルはスコープを抜けると自動的に閉じられます。もしくは、次のようにします:</p>
 
 <pre class="perl prettyprint">
 <a href="http://perldoc.perl.org/functions/close.html">close</a> $fh2;
@@ -1444,7 +1442,7 @@
 <p class=original>The function <code>-f</code> is a built-in function which tests whether the named file is a plain file.</p>
 <p>関数<code>-f</code> は組込の関数で与えられた名前のファイルが普通のファイルかどうかをテストします。</p>
 <p class=original>These are just three of <a href="http://perldoc.perl.org/functions/-X.html">a large class of functions</a> of the form <code>-X</code> where <code>X</code> is some lower- or upper-case letter. These functions are called <i>file tests</i>. Note the leading minus sign. In a Google query, the minus sign indicates to exclude results containing this search term. This makes file tests hard to Google for! Just search for "perl file test" instead.</p>
-<p><code>-X</code>形式の<a href="http://perldoc.perl.org/functions/-X.html">大きなクラスの関数</a>の3つの関数です。<code>X</code>は小文字か大文字です。これらの関数は<i>ファイルテスト</i>と呼ばれます。マイナス記号が先に来ることに気をつけてください。Googleクエリでは、マイナス記号は、その言葉を結果に含めないことを指示します。そのため、ファイルテストをGoogleで検索しづらくしています! 代わりに、"perl file test"で検索して下さい。</p>
+<p><code>-X</code>形式の<a href="http://perldoc.perl.org/functions/-X.html">大きなクラスの関数</a>の3つの関数です。<code>X</code>は小文字か大文字です。これらの関数は<i>ファイルテスト</i>と呼ばれます。マイナス記号が先に来ることに気をつけてください。Googleクエリでは、マイナス記号は、その言葉を結果に含めないことを指示します。そのため、ファイルテストをGoogleで検索しづらくしています! 代わりに、 "perl file test"(訳註: "perl ファイルテスト")で検索して下さい。</p>
 
 <h2 class="original">Regular expressions</h2>
 <h2>正規表現</h2>
@@ -1578,7 +1576,7 @@
 </pre>
 
 <p class=original>Once the Perl module is created and <code>perl</code> knows where to look for it, you can use the <code>require</code> built-in function to search for and execute it during a Perl script. For example, calling <code>require Demo::StringUtils</code> causes the Perl interpreter to search each directory listed in <code>PERL5LIB</code> in turn, looking for a file called <code>Demo/StringUtils.pm</code>. After the module has been loaded, the subroutines and variables that were defined there suddenly become available in the main script. Our example script might be called <code>main.pl</code> and read as follows:</p>
-<p>Perlモジュールが作られて、<code>perl</code>がそれがどこにあるかを知っていれば、組込の<code>require</code>関数を使って探し、Perlのスクリプト中で実行することができます。例えば、<code>require Demo::StringUtils</code>を呼ぶと、Perlインタープリタは<code>PERL5LIB</code>にリストされているディレクトリを順番に、<code>Demo/StringUtils.pm</code>というファイルを探します。モジュールがロードされたら、突然にサブルーチンと変数がメインスクリプトに定義されます。この例のスクリプトを<code>main.pl</code>と呼びましょう。続けて読んでくさい:</p>
+<p>Perlモジュールが作られて、<code>perl</code>がそれがどこにあるかを知っていれば、組込の<code>require</code>関数を使って探し、Perlのスクリプト中で実行することができます。例えば、<code>require Demo::StringUtils</code>を呼ぶと、Perlインタープリタは<code>PERL5LIB</code>にリストされているディレクトリを順番に、 <code>Demo/StringUtils.pm</code>というファイルを探します。モジュールがロードされたら、突然にサブルーチンと変数がメインスクリプトに定義されます。この例のスクリプトを<code>main.pl</code>と呼びましょう。続けて読んでくさい:</p>
 
 <pre class="perl prettyprint">
 use strict;
@@ -1678,7 +1676,7 @@
 </ol>
 
 <p class="original">Because of this, in practice you will find that most "packages" and "modules" produced by reliable third parties <em>can</em> be regarded and referred to interchangeably. However, it is important that you do not take this for granted, because one day you <em>will</em> meet code produced by a madman.</p>
-<p>これにより, 信頼できるサードパーティに作られた、ほとんどの"packages"と"modules"を見つけることができ、相互に関係し参照され<em>うる</em>。しかし、これが当たり前と思わないことは重要です。いつか、常軌を逸した人が作ったコードに出会う<em>でしょう</em>。</p>
+<p>これにより, 信頼できるサードパーティに作られた、ほとんどの"パッケージ"と"モジュール"を見つけることができ、相互に関係し参照することが<em>できます</em>。しかし、これが当たり前と思わないことは重要です。いつか、常軌を逸した人が作ったコードに出会う<em>でしょう</em>。</p>
 
 <h2 class="original">Object-oriented Perl</h2>
 <h2>オブジェクト指向Perl</h2>
@@ -1747,7 +1745,7 @@
 </pre>
 
 <p class="original">Note: literally any reference can be blessed into any class. It's up to you to ensure that (1) the referent can actually be used as an instance of this class and (2) that the class in question exists and has been loaded.</p>
-<p>注意: 文字通り、どのようなリファレンスも、どのようなクラスにでもblessされえます。(1)リファレンスが実際にそのクラスのインスタンスとして使われているかと、(2)問題のクラスが存在し、ロードされているかを保証するのはあなた次第です。</p>
+<p>注意: 文字通り、どのようなリファレンスも、どのようなクラスにでもblessすることができます。(1)リファレンスが実際にそのクラスのインスタンスとして使われているかと、(2)問題のクラスが存在し、ロードされているかを保証するのはあなた次第です。</p>
 
 <p class="original">You can still work with the original hash in the usual way:</p>
 <p>まだ、通常のやり方でオリジナルのハッシュを操作できます</p>
@@ -1856,7 +1854,7 @@
 </pre>
 
 <p class="original">A <code>BEGIN</code> block is always executed first. If you create multiple <code>BEGIN</code> blocks (don't), they are executed in order from top to bottom as the compiler encounters them. A <code>BEGIN</code> block always executes first even if it is placed halfway through a script (don't do this) or even at the end (or this).</p>
-<p><code>BEGIN</code>ブロックは常にさいs鬼実行されます。複数の<code>BEGIN</code>ブロックを書くと(don't)、 上から順番にコンパイラがそれらに出会う順番に実行されます。<code>BEGIN</code>ブロックは常に最初に実行されます。もし、BEGINブロックがスクリプトの途中(そんなことはしないでください)や、最後(or this)に書かれていたりしてさえも。</p>
+<p><code>BEGIN</code>ブロックは常に最初に実行されます。複数の<code>BEGIN</code>ブロックを書くと(don't)、 上から順番にコンパイラがそれらに出会う順番に実行されます。<code>BEGIN</code>ブロックは常に最初に実行されます。もし、BEGINブロックがスクリプトの途中(そんなことはしないでください)や、最後(or this)に書かれていたりしてさえも。</p>
 <p class="original">Because they are executed at compilation time, a <code>BEGIN</code> 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 <code>BEGIN</code> blocks in conditionals!</strong> If you want to do something conditionally at compile time, you need to put the conditional <em>inside</em> the <code>BEGIN</code> block:</p>
 <p>コンパイル時に実行されるので、<code>BEGIN</code>ブロックが条件ブロックの中にあっても、<em>まだ</em>最初に実行されます。たとえ、条件の評価が偽であり、条件が<em>まだまったく評価されていない</em>にもかかわらず、実際には、<em>評価されることがない</em>としてもです。<strong><code>BEGIN</code>ブロックを条件の中に置いては行けません!</strong> コンパイル時に何かしらの条件付きのことがしたければ、<code>BEGIN</code>ブロックの<em>中に</em>条件文を置かなければなりません:</p>
 <pre class="perl prettyprint">
@@ -1961,7 +1959,7 @@
 <p><code>import()</code>された結果として、<code>Caterpillar::crawl()</code>のようなメソッドが<code>crawl()</code>のように、修飾なしに利用可能になります。これは、タイプ数の節約になります。(注意: <code>@EXPORT_OK</code>のコンセプトにかかわらず、 全てのメソッドは、上で見たように、"longhand"で呼ぶことが出来ます。 Perlにはプライベートメソッドはありません。通例、1つか2つのアンダースコアから始まる名前が付けられたメソッドはプライベートを意図します。</p>
 
 <p class="original">Note how, again, we are back in a situation where without other clues it might not be easy to tell where <code>crawl()</code> was originally defined. The moral of this story is twofold:</p>
-<p>再度注意しておくと、他のものないシチュエーションに戻ると、<code>crawl()</code>が元々どこで定義されていたのかを教えるのは簡単ではありません。この話の教訓は2つあります:</p>
+<p>再度注意しておくと、"longhand"で使っていないような場合、<code>crawl()</code>が元々どこで定義されていたのかを教えるのは簡単ではありません。この話の教訓は2つあります:</p>
 
 <ol>
 <li>
@@ -1970,7 +1968,7 @@
 </li>
 <li>
     <p class="original">When <code>use</code>ing a module which makes use of Exporter, always explicitly name the subroutines you want to <code>import()</code>. If you don't want to <code>import()</code> any subroutines and wish to refer to them longhand, you must supply an explicit empty list: <code>use Caterpillar ()</code>.</p>
-    <p>モジュールを<code>use</code>すると、常に明示的に<code>import()</code>したいサブルーチンの名前書きます。何のサブルーチンも<code>import()</code>したくなく、longhandで参照したいのなら、からのリストを提供しなければいけません。: <code>use Caterpillar ()</code>.</p></li>
+    <p>モジュールを<code>use</code>すると、常に明示的に<code>import()</code>したいサブルーチンの名前書きます。何のサブルーチンも<code>import()</code>したくなく、longhandで参照したいのなら、空のリストを提供しなければいけません: <code>use Caterpillar ()</code>.</p></li>
 </ol>
 
 <h2 class="original">Miscellaneous notes</h2>
@@ -1987,7 +1985,7 @@
 use Account qw{create open close suspend delete};
 </pre>
 		<p class="original">There are <a href="http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators">many other quote-like operators</a>.</p>
-		<p><a href="http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators">多くの他のクォートライクなオペレータがあります</a>。</p>
+		<p><a href="http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators">多くの他のクォートライクなオペレータ</a>があります。</p>
 	</li>
 	<li>
 		<p class="original">In <code>=~ m//</code> and <code>=~ s///</code> operations, you can use braces instead of slashes as the regex delimiters. This is quite useful if your regex contains a lot of slashes, which would otherwise need escaping with backslashes. For example, <code>=~ m{///}</code> matches three literal forward slashes, and <code>=~ s{^https?://}{}</code> removes the protocol part of a URL.</p>



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