ktats****@users*****
ktats****@users*****
2012年 9月 2日 (日) 01:47:32 JST
Index: docs/articles/qntm.org/files/perl/perl.html diff -u docs/articles/qntm.org/files/perl/perl.html:1.9 docs/articles/qntm.org/files/perl/perl.html:1.10 --- docs/articles/qntm.org/files/perl/perl.html:1.9 Sun Sep 2 01:35:41 2012 +++ docs/articles/qntm.org/files/perl/perl.html Sun Sep 2 01:47:32 2012 @@ -518,8 +518,8 @@ print @array; # "AlphaBetaGoo"; print $scalar, @array, 98; # "-X-AlphaBetaGoo98"; </pre> -<p class="original">You can force any expression to be evaluated in scalar context using the <code>scalar</code> built-in function. In fact, this is why we use <code>scalar</code> to retrieve the length of an array.</p> -<p>ã©ã®ãããªå¼ã<code>scalar</code>çµè¾¼é¢æ°ã使ãã°ã¹ã«ã©ã³ã³ããã¹ãã§å¼·å¶çã«è©ä¾¡ãããã¨ãåºæ¥ã¾ãããã®ãã¨ãããªã<code>scalar</code>ãé åã®é·ããåãã®ã«ä½¿ãã®ãã®çç±ã§ãã</p> +<p class="original">You can force any expression to be evaluated in scalar context using the <code><a href="http://perldoc.perl.org/functions/scalar.html">scalar</a></code> built-in function. In fact, this is why we use <code>scalar</code> to retrieve the length of an array.</p> +<p>ã©ã®ãããªå¼ã<code>scalar</code>çµè¾¼é¢æ°ã使ãã°ã¹ã«ã©ã³ã³ããã¹ãã§å¼·å¶çã«è©ä¾¡ãããã¨ãåºæ¥ã¾ãããã®ãã¨ãããªã<code><a href="http://perldoc.perl.org/functions/scalar.html">scalar</a></code>ãé åã®é·ããåãã®ã«ä½¿ãã®ãã®çç±ã§ãã</p> <p class=original>You are not bound by law or syntax to return a scalar value when a subroutine is evaluated in scalar context, nor to return a list value in list context. As seen above, Perl is perfectly capable of fudging the result for you.</p> <p>ãµãã«ã¼ãã³ãã¹ã«ã©ã³ã³ããã¹ãã§è©ä¾¡ãããã¨ãã«ã¹ã«ã©ãè¿ããããªæ³å¾ãã·ã³ã¿ãã¯ã¹ã«ã¯ããªãã¯ç¸ããã¦ãã¾ããããã¾ãããªã¹ãã³ã³ããã¹ãã§ãªã¹ããè¿ããã¨ãã¾ãåãã§ããä¸ã§è¦ãããã«ãPerlã¯å®å ¨ã«ããªãã®ããã«çµæãä½ããã¨ãã§ãã¾ãã</p> @@ -993,36 +993,36 @@ print @stack; # "FredEileenDeniseCharlie" </pre> -<p class=original><code>pop</code> extracts and returns the final element of the array. This can be thought of as the top of the stack:</p> -<p><code>pop</code> ã¯é åã®æå¾ã®è¦ç´ ãå¼ãåºãã¦è¿ãã¾ããã¹ã¿ãã¯ã®ä¸ã¨ãã¦èãããã¾ã:</p> +<p class=original><code><a href="http://perldoc.perl.org/functions/pop.html">pop</a></code> extracts and returns the final element of the array. This can be thought of as the top of the stack:</p> +<p><code><a href="http://perldoc.perl.org/functions/pop.html">pop</a></code> ã¯é åã®æå¾ã®è¦ç´ ãå¼ãåºãã¦è¿ãã¾ããã¹ã¿ãã¯ã®ä¸ã¨ãã¦èãããã¾ã:</p> <pre class="perl prettyprint"> print pop @stack; # "Charlie" print @stack; # "FredEileenDenise" </pre> -<p class=original><code>push</code> appends extra elements to the end of the array:</p> -<p><code>push</code> ã¯è¿½å ã®è¦ç´ ãé åã®æå¾ã«ä»å ãã¾ã:</p> +<p class=original><code><a href="http://perldoc.perl.org/functions/push.html">push</a></code> appends extra elements to the end of the array:</p> +<p><code><a href="http://perldoc.perl.org/functions/push.html">push</a></code> ã¯è¿½å ã®è¦ç´ ãé åã®æå¾ã«ä»å ãã¾ã:</p> <pre class="perl prettyprint"> push @stack, "Bob", "Alice"; print @stack; # "FredEileenDeniseBobAlice" </pre> -<p class=original><code>shift</code> extracts and returns the first element of the array:</p> -<p><code>shift</code> ã¯é åã®æåã®è¦ç´ ãå¼ãåºãã¦è¿ãã¾ã:</p> +<p class=original><code><a href="http://perldoc.perl.org/functions/shift.html">shift</a></code> extracts and returns the first element of the array:</p> +<p><code><a href="http://perldoc.perl.org/functions/shift.html">shift</a></code> ã¯é åã®æåã®è¦ç´ ãå¼ãåºãã¦è¿ãã¾ã:</p> <pre class="perl prettyprint"> print shift @stack; # "Fred" print @stack; # "EileenDeniseBobAlice" </pre> -<p class=original><code>unshift</code> inserts new elements at the beginning of the array:</p> -<p><code>unshift</code> é åã®æåã«æ°ããè¦ç´ ãæ¿å ¥ãã¾ã:</p> +<p class=original><code><a href="http://perldoc.perl.org/functions/unshift.html">unshift</a></code> inserts new elements at the beginning of the array:</p> +<p><code><a href="http://perldoc.perl.org/functions/unshift.html">unshift</a></code> é åã®æåã«æ°ããè¦ç´ ãæ¿å ¥ãã¾ã:</p> <pre class="perl prettyprint"> unshift @stack, "Hank", "Grace"; print @stack; # "HankGraceEileenDeniseBobAlice" </pre> -<p class=original><code>pop</code>, <code>push</code>, <code>shift</code> and <code>unshift</code> are all special cases of <code>splice</code>. <code>splice</code> removes and returns an array slice, replacing it with a different array slice:</p> -<p><code>pop</code>ã<code>push</code>ã <code>shift</code>ã<code>unshift</code> ã¯ãå ¨ã¦ã<code>splice</code>ã®ç¹å¥ãªã±ã¼ã¹ã§ãã<code>splice</code> ã¯ãé åã®ã¹ã©ã¤ã¹ãåé¤ãã¦ãè¿ãã¾ããå¥ã®é åã¹ã©ã¤ã¹ã§ãããç½®ãæãã¾ã:</p> +<p class=original><code>pop</code>, <code>push</code>, <code>shift</code> and <code>unshift</code> are all special cases of <code><a href="http://perldoc.perl.org/functions/splice.html">splice</a></code>. <code>splice</code> removes and returns an array slice, replacing it with a different array slice:</p> +<p><code>pop</code>ã<code>push</code>ã <code>shift</code>ã<code>unshift</code> ã¯ãå ¨ã¦ã<code><a href="http://perldoc.perl.org/functions/splice.html">splice</a></code>ã®ç¹å¥ãªã±ã¼ã¹ã§ãã<code>splice</code> ã¯ãé åã®ã¹ã©ã¤ã¹ãåé¤ãã¦ãè¿ãã¾ããå¥ã®é åã¹ã©ã¤ã¹ã§ãããç½®ãæãã¾ã:</p> <pre class="perl prettyprint"> print splice(@stack, 1, 4, "<<<", ">>>"); # "GraceEileenDeniseBob" print @stack; # "Hank<<<>>>Alice" @@ -1081,7 +1081,7 @@ <p class=original><code>grep</code> and <code>map</code> may be combined to form <i><a href="https://en.wikipedia.org/wiki/List_comprehension">list comprehensions</a></i>, an exceptionally powerful feature conspicuously absent from many other programming languages.</p> <p><code>grep</code> 㨠<code>map</code> ã¯ã<i><a href="https://en.wikipedia.org/wiki/List_comprehension">ãªã¹ãå å«</a></i>ã®å½¢ã«å«ã¾ãã¾ããä»ã®å¤ãã®ããã°ã©ãã³ã°è¨èªã«ç®ç«ã£ã¦æ¬ ãã¦ãããä¾å¤çã«å¼·åãªæ©è½ã§ãã</p> -<p class=original>By default, the <code>sort</code> function returns the input array, sorted into lexical (alphabetical) order:</p> +<p class=original>By default, the <code><a href="http://perldoc.perl.org/functions/sort.html">sort</a></code> function returns the input array, sorted into lexical (alphabetical) order:</p> <p>ããã©ã«ãã§ã¯ã<code>sort</code>é¢æ°ã¯å ¥åãããé åãæåé (ã¢ã«ãã¡ãããé )ã«ä¸¦ã³ããã¾ã:</p> <pre class="perl prettyprint"> @@ -1304,8 +1304,8 @@ <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 <code>exit</code>.</p> -<p>Perlããçµäºããéã«ã<code>exit</code>ã使ã£ã¦(0ãã255ã¾ã§ã®)好ããªãªã¿ã¼ã³ã³ã¼ããè¿ãã¾ãã</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 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>