=encoding euc-jp =head1 NAME =begin original perlfaq - frequently asked questions about Perl =end original perlfaq - Perl に関するよくある質問 =head1 DESCRIPTION =begin original The perlfaq comprises several documents that answer the most commonly asked questions about Perl and Perl programming. It's divided by topic into nine major sections outlined in this document. =end original perlfaq は、Perl と Perl プログラミングに関するもっともよくある質問へ 回答しているいくつかの文書から構成されています。 これはこの文書に概説されている、9 個の大きな区分に分割されています。 =head2 Where to find the perlfaq (perlfaq を探す場所) =begin original The perlfaq is an evolving document. Read the latest version at L. It is also included in the standard Perl distribution. =end original perlfaq は 進化している文書です。 L で最新版を読んでください。 また標準 Perl 配布にも含まれています。 =head2 How to use the perlfaq (perlfaq の使い方) =begin original The C command line tool is part of the standard Perl distribution. To read the perlfaq: =end original C コマンドラインツールは標準 Perl 配布の一部です。 perlfaq を読むには: $ perldoc perlfaq =begin original To search the perlfaq question headings: =end original perlfaq の質問の見出しを検索するには: $ perldoc -q open =head2 How to contribute to the perlfaq (perlfaq への貢献方法) =begin original Review L. If you don't find your suggestion create an issue or pull request against L. =end original L を見てください。 あなたの提案がそこになければ L に issue を作るか pull request を送ってください。 =begin original Once approved, changes are merged into L, the repository which drives L, and they are distributed with the next Perl 5 release. =end original 承認されれば、変更点は L を管理する L にマージされ、次の Perl 5 リリースで 配布されます。 =head2 What if my question isn't answered in the FAQ? (私の質問の答えが FAQ にないときは?) =begin original Try the resources in L. =end original L のリソースを試してください。 =head1 TABLE OF CONTENTS =over 4 =item perlfaq1 - General Questions About Perl (perlfaq1 - Perl に関する一般的な質問) =item perlfaq2 - Obtaining and Learning about Perl (perlfaq2 - Perl の入手と学習) =item perlfaq3 - Programming Tools (perlfaq3 - プログラミングツール) =item perlfaq4 - Data Manipulation (perlfaq4 - データ操作) =item perlfaq5 - Files and Formats (perlfaq5 - ファイルとフォーマット) =item perlfaq6 - Regular Expressions (perlfaq6 - 正規表現) =item perlfaq7 - General Perl Language Issues (perlfaq7 - Perl 言語一般に関することがら) =item perlfaq8 - System Interaction (perlfaq8 - システムとの相互作用) =item perlfaq9 - Web, Email and Networking (perlfaq9 - Web、メール、ネットワーク) =back =head1 THE QUESTIONS =head2 L: General Questions About Perl (L: Perl に関する一般的な質問) =begin original This section of the FAQ answers very general, high-level questions about Perl. =end original このセクションでは、Perl に関する非常に一般的で高レベルの質問に答えます。 =over 4 =item * =begin original What is Perl? =end original Perlってなんですか? =item * =begin original Who supports Perl? Who develops it? Why is it free? =end original だれが Perl をサポートしているのですか? 誰が開発しているのですか? なぜフリーなのでしょうか? =item * =begin original Which version of Perl should I use? =end original どのバージョンの Perl を使うべきなのでしょうか? =item * =begin original What are Perl 4, Perl 5, or Perl 6? =end original Perl 4, Perl 5, Perl 6 って何ですか? =item * =begin original What is Perl 6? =end original Perl 6 ってなんですか? =item * =begin original How stable is Perl? =end original Perl はどのくらい安定しているのでしょうか? =item * =begin original Is Perl difficult to learn? =end original Perl は学ぶのが難しいのでしょうか? =item * =begin original How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl? =end original Java, Python, REXX, Scheme, Tcl といった他の言語と比べて Perl はどうなんでしょうか? =item * =begin original Can I do [task] in Perl? =end original Perlで○○を行えますか? =item * =begin original When shouldn't I program in Perl? =end original Perl でプログラムするべきではないのはどういう場合ですか? =item * =begin original What's the difference between "perl" and "Perl"? =end original “perl”と“Perl”の違いはなんですか? =item * =begin original What is a JAPH? =end original JAPH ってなんですか? =item * =begin original How can I convince others to use Perl? =end original 他の人に、どうすれば Perl を使うように説得できるでしょうか? =back =head2 L: Obtaining and Learning about Perl (L: Perl の入手と学習) =begin original This section of the FAQ answers questions about where to find source and documentation for Perl, support, and related matters. =end original FAQ のこのセクションでは、Perl のソースや Perl に関するドキュメントが 手に入れられる場所に関する質問や、サポートとトレーニング、関連した 出来事に関する質問に回答しています。 =over 4 =item * =begin original What machines support Perl? Where do I get it? =end original perl はどんなマシンで動きますか? どこで入手できますか? =item * =begin original How can I get a binary version of Perl? =end original バイナリ形式の perl はどうすれば入手できますか? =item * =begin original I don't have a C compiler. How can I build my own Perl interpreter? =end original 私は C コンパイラーを持っていません。どうすれば自分用の Perl インタプリタをビルドできますか? =item * =begin original I copied the Perl binary from one machine to another, but scripts don't work. =end original perl のバイナリをあるマシンから別のマシンにコピーしたのだけど、スクリプトが動きませんでした =item * =begin original I grabbed the sources and tried to compile but gdbm/dynamic loading/malloc/linking/... failed. How do I make it work? =end original ソースを取ってきてコンパイルしようとしたのだけど、gdbm/dynamic loading/malloc/linking/... failed. となってしまった。動くようにするにはどうすればいいの? =item * =begin original What modules and extensions are available for Perl? What is CPAN? =end original Perl に使えるモジュールとかエクステンションってなんですか? CPAN ってなに? =item * =begin original Where can I get information on Perl? =end original Perl に関する情報はどこで手に入れられますか? =item * =begin original What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? =end original perl.com, Perl Mongers, pm.org, perl.org, cpan.org ってなんですか? =item * =begin original Where can I post questions? =end original どこに質問を投稿できますか? =item * =begin original Perl Books =end original Perl の書籍 =item * =begin original Which magazines have Perl content? =end original Perl 関連の雑誌は? =item * =begin original Which Perl blogs should I read? =end original 読むべき Perl ブログは? =item * =begin original What mailing lists are there for Perl? =end original Perlのためのメイリングリストって? =item * =begin original Where can I buy a commercial version of Perl? =end original どこで商用版 Perl を買うことができますか? =item * =begin original Where do I send bug reports? =end original バグレポートはどこへ送るの? =back =head2 L: Programming Tools (L: プログラミングツール) =begin original This section of the FAQ answers questions related to programmer tools and programming support. =end original FAQ のこのセクションでは、プログラマーツールやプログラミングサポートに 関する質問に回答しています。 =over 4 =item * =begin original How do I do (anything)? =end original ○○をするにはどうすればいいの? =item * =begin original How can I use Perl interactively? =end original 対話的に Perl を使うには? =item * =begin original How do I find which modules are installed on my system? =end original 自分のシステムに入っているモジュールを知るには? =item * =begin original How do I debug my Perl programs? =end original 私の Perl プログラムをデバッグするには? =item * =begin original How do I profile my Perl programs? =end original 私の Perl プログラムのプロファイルを取るには? =item * =begin original How do I cross-reference my Perl programs? =end original 私の Perl プログラムのクロスリファレンスをとるには? =item * =begin original Is there a pretty-printer (formatter) for Perl? =end original Perl 用のプリティプリンター(フォーマッター)はありますか? =item * =begin original Is there an IDE or Windows Perl Editor? =end original Perl の統合開発環境とか Windows Perl Editor はありますか? =item * =begin original Where can I get Perl macros for vi? =end original vi 用の Perl マクロはどこで入手できますか? =item * =begin original Where can I get perl-mode or cperl-mode for emacs? =end original emacs の perl-mode や cperl-mode はどこで入手できますか? =item * =begin original How can I use curses with Perl? =end original Perl で curses を使うには? =item * =begin original How can I write a GUI (X, Tk, Gtk, etc.) in Perl? =end original Perl で GUI (X, Tk, Gtk など) を書くには? =item * =begin original How can I make my Perl program run faster? =end original 私の Perl プログラムをもっと速くするには? =item * =begin original How can I make my Perl program take less memory? =end original 私の Perl プログラムのメモリ消費量を少なくするには? =item * =begin original Is it safe to return a reference to local or lexical data? =end original ローカルやレキシカルなデータへのポインターを返すことは安全ですか? =item * =begin original How can I free an array or hash so my program shrinks? =end original 配列やハッシュを解放して私のプログラムを小さくするには? =item * =begin original How can I make my CGI script more efficient? =end original 私の CGI スクリプトをもっと効率よくするには? =item * =begin original How can I hide the source for my Perl program? =end original 私の Perl プログラムのソースを隠すには? =item * =begin original How can I compile my Perl program into byte code or C? =end original 私の Perl プログラムをバイトコードや C へコンパイルするには? =item * =begin original How can I get C<#!perl> to work on [MS-DOS,NT,...]? =end original MS-DOS, NT, etc で '#!perl' が動作するようにするには? =item * =begin original Can I write useful Perl programs on the command line? =end original コマンドライン上で便利な Perl プログラムを書けますか? =item * =begin original Why don't Perl one-liners work on my DOS/Mac/VMS system? =end original なぜ私の DOS/Mac/VMS システムでは一行野郎は動かないのでしょうか? =item * =begin original Where can I learn about CGI or Web programming in Perl? =end original Perl による CGI や Web プログラミングについてどこで学べますか? =item * =begin original Where can I learn about object-oriented Perl programming? =end original オブジェクト指向の Perl プログラミングはどこで学べますか? =item * =begin original Where can I learn about linking C with Perl? =end original C と Perl のリンクについてはどこで学べますか? =item * =begin original I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong? =end original perlembed や perlguts なんかを読んだのだけど、私の C プログラムに perl を組み込めません。何が悪いのでしょうか? =item * =begin original When I tried to run my script, I got this message. What does it mean? =end original 私のスクリプトを実行したとき、こんなメッセージを受け取りました。これって何を意味しているのでしょうか? =item * =begin original What's MakeMaker? =end original MakeMaker ってなんですか? =back =head2 L: Data Manipulation (L: データ操作) =begin original This section of the FAQ answers questions related to manipulating numbers, dates, strings, arrays, hashes, and miscellaneous data issues. =end original FAQ のこのセクションでは、数値、日付、文字列、配列、ハッシュその他の データの取り扱いに関する質問に回答しています。 =over 4 =item * =begin original Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)? =end original なぜ 19.95 のような数字ではなく、19.9499999999999 のような長い数字が出てきたんでしょうか? =item * =begin original Why is int() broken? =end original なぜ int() は壊れているのでしょう? =item * =begin original Why isn't my octal data interpreted correctly? =end original なぜ私の 8 進データは正しく解釈されないのでしょうか? =item * =begin original Does Perl have a round() function? What about ceil() and floor()? Trig functions? =end original Perl には丸め関数がありますか? ceil() と floor() とは何ですか? 三角関数は? =item * =begin original How do I convert between numeric representations/bases/radixes? =end original 数値表現や基底や基数を変換するには? =item * =begin original Why doesn't & work the way I want it to? =end original なぜ & は私の思った通りに動作しないのでしょうか? =item * =begin original How do I multiply matrices? =end original 行列の積を計算するには? =item * =begin original How do I perform an operation on a series of integers? =end original 整数値の並びに対してある操作を実行するには? =item * =begin original How can I output Roman numerals? =end original ローマ数字を出力するには? =item * =begin original Why aren't my random numbers random? =end original なぜ私の乱数はランダムでないの? =item * =begin original How do I get a random number between X and Y? =end original X と Y の間の乱数を得るには? =item * =begin original How do I find the day or week of the year? =end original その年の何日目であるかを知るには? =item * =begin original How do I find the current century or millennium? =end original 現在の世紀や千年紀を知るには? =item * =begin original How can I compare two dates and find the difference? =end original 二つの日付文字列を比較するには? =item * =begin original How can I take a string and turn it into epoch seconds? =end original 文字列を受け取って、それを紀元からの経過秒数に変換するには? =item * =begin original How can I find the Julian Day? =end original ユリウス日を求めるには? =item * =begin original How do I find yesterday's date? =end original 昨日の日付を得るには? =item * =begin original Does Perl have a Year 2000 or 2038 problem? Is Perl Y2K compliant? =end original Perl には 2000 年問題や 2038 年問題があるのですか? Perl は 2000 年対応ですか? =item * =begin original How do I validate input? =end original 入力を検査するには? =item * =begin original How do I unescape a string? =end original 文字列のアンエスケープ (unescape)をするには? =item * =begin original How do I remove consecutive pairs of characters? =end original キャラクタの連続した組を取り除くには? =item * =begin original How do I expand function calls in a string? =end original 文字列中にある関数呼び出しを展開するには? =item * =begin original How do I find matching/nesting anything? =end original 何かがマッチしている/ネストしているということを検出するには? =item * =begin original How do I reverse a string? =end original 文字列をひっくり返すには? =item * =begin original How do I expand tabs in a string? =end original 文字列中にあるタブを展開するには? =item * =begin original How do I reformat a paragraph? =end original 段落を整形するには? =item * =begin original How can I access or change N characters of a string? =end original 文字列の最初の N 文字にアクセスしたり、それを変更するには? =item * =begin original How do I change the Nth occurrence of something? =end original 何かの N 番目のものを変更するには? =item * =begin original How can I count the number of occurrences of a substring within a string? =end original ある文字列の中に存在する部分文字列が何個あるのかを数えるには? =item * =begin original How do I capitalize all the words on one line? =end original 一行にあるすべての単語をキャピタライズするには? =item * =begin original How can I split a [character]-delimited string except when inside [character]? =end original (とある文字)の内側にある時を除き、(とある文字)で終端されている文字列を分割するには? =item * =begin original How do I strip blank space from the beginning/end of a string? =end original 文字列の先頭や末尾にある空白を剥ぎ取るには? =item * =begin original How do I pad a string with blanks or pad a number with zeroes? =end original 文字列に空白をパッディングしたり、数値にゼロをパッディングしたりするには? =item * =begin original How do I extract selected columns from a string? =end original 文字列から選択されたカラムを取り出すには? =item * =begin original How do I find the soundex value of a string? =end original 文字列の soundex 値を見つけるには? =item * =begin original How can I expand variables in text strings? =end original テキスト文字列の中にある変数を展開するには? =item * =begin original What's wrong with always quoting "$vars"? =end original 常にクォーティング "$vars" することの何が悪いの? =item * =begin original Why don't my EEHERE documents work? =end original なぜ私の EEHERE ドキュメントがうまく動かないのでしょう? =item * =begin original What is the difference between a list and an array? =end original リストと配列の差とはなんですか? =item * =begin original What is the difference between $array[1] and @array[1]? =end original $array[1] と @array[1] との間の違いはなんですか? =item * =begin original How can I remove duplicate elements from a list or array? =end original 配列やリストにある重複した要素を削除するには? =item * =begin original How can I tell whether a certain element is contained in a list or array? =end original リストや配列の内容にある特定の要素があるかどうかを確かめるには? =item * =begin original How do I compute the difference of two arrays? How do I compute the intersection of two arrays? =end original 二つの配列の差(difference)を求めるには? 二つの配列の共通要素(inter section)を求めるには? =item * =begin original How do I test whether two arrays or hashes are equal? =end original 二つの配列や二つのハッシュが等しいかどうかを検査するには? =item * =begin original How do I find the first array element for which a condition is true? =end original ある条件が真となる最初の配列要素を見つけだすには? =item * =begin original How do I handle linked lists? =end original リンク付きリストを扱うには? =item * =begin original How do I handle circular lists? =end original 循環リストを扱うには? =item * =begin original How do I shuffle an array randomly? =end original 配列をランダムにかき混ぜるには? =item * =begin original How do I process/modify each element of an array? =end original 配列の各要素に対する処理や、変更を行うには? =item * =begin original How do I select a random element from an array? =end original ある配列からランダムに要素を選択するには? =item * =begin original How do I permute N elements of a list? =end original N 要素を持つリストの順列(permute)を求めるには? =item * =begin original How do I sort an array by (anything)? =end original (なにか)で配列をソートするには? =item * =begin original How do I manipulate arrays of bits? =end original ビット配列を扱うには? =item * =begin original Why does defined() return true on empty arrays and hashes? =end original なぜ空の配列やハッシュに defined() を使ったときに真が返ってくるのでしょう? =item * =begin original How do I process an entire hash? =end original ハッシュ全体を処理するには? =item * =begin original How do I merge two hashes? =end original 二つのハッシュをマージするには? =item * =begin original What happens if I add or remove keys from a hash while iterating over it? =end original ハッシュに対して反復操作を行っているときにキーの追加や削除をすると何が起きますか? =item * =begin original How do I look up a hash element by value? =end original ハッシュの要素をその値で検索するには? =item * =begin original How can I know how many entries are in a hash? =end original ハッシュにどれくらいの要素があるのを知るには? =item * =begin original How do I sort a hash (optionally by value instead of key)? =end original ハッシュを(キーではなく値で)ソートするには? =item * =begin original How can I always keep my hash sorted? =end original 私のハッシュを常にソートされた状態にしておくには? =item * =begin original What's the difference between "delete" and "undef" with hashes? =end original ハッシュに対する "delete" と "undef"との間の違いは? =item * =begin original Why don't my tied hashes make the defined/exists distinction? =end original なぜわたしの tie されたハッシュは defined と exists を区別しないのでしょうか? =item * =begin original How do I reset an each() operation part-way through? =end original each() 操作の途中でリセットしてしまうには? =item * =begin original How can I get the unique keys from two hashes? =end original 二つのハッシュからユニークなキーを取りだすには? =item * =begin original How can I store a multidimensional array in a DBM file? =end original DBM ファイルに多次元配列を格納するには? =item * =begin original How can I make my hash remember the order I put elements into it? =end original わたしのハッシュが格納した順番を覚えておくようにするには? =item * =begin original Why does passing a subroutine an undefined element in a hash create it? =end original なぜあるハッシュの未定義要素をサブルーチンに渡すとそれを作成するのでしょうか? =item * =begin original How can I make the Perl equivalent of a C structure/C++ class/hash or array of hashes or arrays? =end original C の構造体/C++ のクラスのハッシュ、配列のハッシュ、配列と等価なものを Perl で作成するには? =item * =begin original How can I use a reference as a hash key? =end original ハッシュのキーとしてリファレンスを使うには? =item * =begin original How can I check if a key exists in a multilevel hash? =end original 複数レベルハッシュにキーがあるかどうかをチェックするには? =item * =begin original How can I prevent addition of unwanted keys into a hash? =end original 望んでいないキーをハッシュに追加されないようにすることができますか? =item * =begin original How do I handle binary data correctly? =end original バイナリデータを正しく扱うには? =item * =begin original How do I determine whether a scalar is a number/whole/integer/float? =end original あるスカラ値が数値/整数/浮動小数点数かどうかを決定するには? =item * =begin original How do I keep persistent data across program calls? =end original プログラムの呼び出しの間に、データ構造を永続的に保持するには? =item * =begin original How do I print out or copy a recursive data structure? =end original 再帰的なデータ構造を出力したりコピーするには? =item * =begin original How do I define methods for every class/object? =end original すべてのクラス/オブジェクトのためのメソッドを定義するには? =item * =begin original How do I verify a credit card checksum? =end original クレジットカードのチェックサムを検査するには? =item * =begin original How do I pack arrays of doubles or floats for XS code? =end original XSプログラムのために倍精度実数や単精度実数の配列を pack するには? =back =head2 L: Files and Formats (L: ファイルとフォーマット) =begin original This section deals with I/O and the "f" issues: filehandles, flushing, formats, and footers. =end original このセクションでは、入出力と“f”に関する事柄: ファイルハンドル (filehandle)、フラッシング(flushing)、フォーマット(format)、 フッター(footer)を扱います。 =over 4 =item * =begin original How do I flush/unbuffer an output filehandle? Why must I do this? =end original 出力ファイルハンドルを flush/unbufferするには? なぜ私はこれをやらなければならないの? =item * =begin original How do I change, delete, or insert a line in a file, or append to the beginning of a file? =end original ファイルの一行を変更する/ファイルのある行を削除する/ファイルの中程で一行挿入する/ファイルの先頭に追加するには? =item * =begin original How do I count the number of lines in a file? =end original あるファイルの行数を数えるには? =item * =begin original How do I delete the last N lines from a file? =end original ファイルの最後の N 行を削除するには? =item * =begin original How can I use Perl's C<-i> option from within a program? =end original プログラム内から Perl の C<-i> オプションを使うには? =item * =begin original How can I copy a file? =end original ファイルをコピーするには? =item * =begin original How do I make a temporary file name? =end original 一時ファイルの名前を作り出すには? =item * =begin original How can I manipulate fixed-record-length files? =end original 固定長レコードのファイルを操作するには? =item * =begin original How can I make a filehandle local to a subroutine? How do I pass filehandles between subroutines? How do I make an array of filehandles? =end original ファイルハンドルをサブルーチンに局所化するには? サブルーチンにファイルハンドルを渡すには? ファイルハンドルの配列を作るには? =item * =begin original How can I use a filehandle indirectly? =end original ファイルハンドルを間接的に扱うには? =item * =begin original How can I set up a footer format to be used with write()? =end original write()と一緒に使うフッターのフォーマットのセットアップをする方法は? =item * =begin original How can I write() into a string? =end original 文字列に対して write() するには? =item * =begin original How can I open a filehandle to a string? =end original ファイルハンドルを文字列としてオープンするには? =item * =begin original How can I output my numbers with commas added? =end original 出力する数字にカンマを付加するには? =item * =begin original How can I translate tildes (~) in a filename? =end original ファイル名の中にあるチルダ (~) を変換するには? =item * =begin original How come when I open a file read-write it wipes it out? =end original ファイルを読み書きモードでオープンしたときに内容をクリアしてしまうのはなぜ? =item * =begin original Why do I sometimes get an "Argument list too long" when I use E*E? =end original なぜ E*E を使ったときに "Argument list too long" (引数リストが長すぎる)となることがあるの? =item * How can I open a file with a leading "E" or trailing blanks? =item * =begin original How can I reliably rename a file? =end original 信頼性のあるファイルのリネームをするには? =item * =begin original How can I lock a file? =end original ファイルをロックするには? =item * =begin original Why can't I just open(FH, "Efile.lock")? =end original なぜ単に open(FH, "Efile.lock")とできないの? =item * =begin original I still don't get locking. I just want to increment the number in the file. How can I do this? =end original まだロックができません。ただ単にファイルにある数値をインクリメントしたいだけなんだけど。どうすればいいの? =item * =begin original All I want to do is append a small amount of text to the end of a file. Do I still have to use locking? =end original ファイルの末尾にちょっとしたテキストを追加したいだけなんです。それでもロックが必要なの? =item * =begin original How do I randomly update a binary file? =end original バイナリファイルをランダムに更新するには? =item * =begin original How do I get a file's timestamp in perl? =end original perl でファイルのタイムスタンプを取得するには? =item * =begin original How do I set a file's timestamp in perl? =end original perl でファイルのタイムスタンプを設定するには? =item * =begin original How do I print to more than one file at once? =end original 複数のファイルを一度に表示するには? =item * =begin original How can I read in an entire file all at once? =end original ファイル全体を一度に読みこむには? =item * =begin original How can I read in a file by paragraphs? =end original ファイルをパラグラフ毎に読み込むには? =item * =begin original How can I read a single character from a file? From the keyboard? =end original ファイルから 1 文字だけ読み出すには? キーボードからは? =item * =begin original How can I tell whether there's a character waiting on a filehandle? =end original あるファイルハンドルが読み込み待ちの文字を待っているかどうかを知るには? =item * =begin original How do I do a C in perl? =end original perlで C をするには? =item * =begin original How do I dup() a filehandle in Perl? =end original Perl でファイルハンドルの dup() をするには? =item * =begin original How do I close a file descriptor by number? =end original 数値によるファイル記述子をクローズするには? =item * =begin original Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? =end original なぜ DOS のパスで "C:\temp\foo" が使えないの? なぜ `C:\temp\foo.exe` はうまくいかないの? =item * =begin original Why doesn't glob("*.*") get all the files? =end original なぜ glob("*.*") で全てのファイルを得られないの? =item * =begin original Why does Perl let me delete read-only files? Why does C<-i> clobber protected files? Isn't this a bug in Perl? =end original なぜ Perl は読みとり専用ファイルを削除してしまうの? なぜC<-i> clobberはファイルをプロテクトするの? これは Perl のバグじゃないの? =item * =begin original How do I select a random line from a file? =end original あるファイルからランダムに行を選択するには? =item * =begin original Why do I get weird spaces when I print an array of lines? =end original 行の配列を出力したときになぜ余計なスペースがつくの? =item * =begin original How do I traverse a directory tree? =end original ディレクトリツリーを辿るには? =item * =begin original How do I delete a directory tree? =end original ディレクトリツリーを削除するには? =item * =begin original How do I copy an entire directory? =end original ディレクトリ全体をコピーするには? =back =head2 L: Regular Expressions (L: 正規表現) =begin original This section is surprisingly small because the rest of the FAQ is littered with answers involving regular expressions. For example, decoding a URL and checking whether something is a number can be handled with regular expressions, but those answers are found elsewhere in this document (in perlfaq9 : "How do I decode or create those %-encodings on the web" and perlfaq4 : "How do I determine whether a scalar is a number/whole/integer/float", to be precise). =end original この章は驚くほど小さくなっています。 なぜなら FAQ の残りの部分は正規表現を伴った回答と一緒にあちこちに 散在しているからです。 たとえば URL をデコードするとかあるものが数値かどうか確認することは 正規表現を使って処理されますが、この回答はこの資料のあらゆる所で 見つけることができます(正確には L: "How do I decode or create those %-encodings on the web" と L: "How do I determine whether a scalar is a number/whole/integer/float")。 =over 4 =item * =begin original How can I hope to use regular expressions without creating illegible and unmaintainable code? =end original 判読し難い、保守できないようなものにすることなく正規表現を使うには? =item * =begin original I'm having trouble matching over more than one line. What's wrong? =end original 二行以上に対するマッチングでトラブルがありました。何が悪いのでしょう? =item * =begin original How can I pull out lines between two patterns that are themselves on different lines? =end original 異なる行にある二つのパターンに挟まれている行を取り出すのはどうやればできますか? =item * =begin original How do I match XML, HTML, or other nasty, ugly things with a regex? =end original XML, HTML あるいはその他の扱いにくくて不細工なものを正規表現でマッチングさせるには? =item * =begin original I put a regular expression into $/ but it didn't work. What's wrong? =end original $/ に正規表現を入れたけど動きません。何が悪いの? =item * =begin original How do I substitute case-insensitively on the LHS while preserving case on the RHS? =end original 演算子の左辺では大小文字を無視して、演算子の右辺では元の大小文字を保存しておくような置換をするには? =item * =begin original How can I make C<\w> match national character sets? =end original C<\w> がローカルな文字セットにマッチするようにするには? =item * How can I match a locale-smart version of C ? =item * =begin original How can I quote a variable to use in a regex? =end original 正規表現の中で使う変数をクォートするには? =item * =begin original What is C really for? =end original C は実際なんのためのものなのですか? =item * =begin original How do I use a regular expression to strip C-style comments from a file? =end original ファイルから、C 形式のコメントを剥ぎ取る(strip)するにはどのように正規表現を使えば良いのでしょうか? =item * =begin original Can I use Perl regular expressions to match balanced text? =end original Perl の正規表現をバランスされたテキストのマッチングに使えますか? =item * =begin original What does it mean that regexes are greedy? How can I get around it? =end original 正規表現が貪欲(greedy)であるとはどういうことですか? =item * =begin original How do I process each word on each line? =end original 各行の単語単位に処理をするにはどうすれば良いですか? =item * =begin original How can I print out a word-frequency or line-frequency summary? =end original 語の出現頻度や行の出現頻度のまとめを出力するには? =item * =begin original How can I do approximate matching? =end original 曖昧なマッチング (approximate matching) はどうやればできますか? =item * =begin original How do I efficiently match many regular expressions at once? =end original たくさんの正規表現を一度に効率良くマッチングするには? =item * =begin original Why don't word-boundary searches with C<\b> work for me? =end original なぜ C<\b> を使った単語境界の検索がうまく行かないのでしょうか? =item * =begin original Why does using $&, $`, or $' slow my program down? =end original なぜ $&, $`, $' を使うとプログラムが遅くなるの? =item * =begin original What good is C<\G> in a regular expression? =end original 正規表現の中で C<\G> を使うと何が良いのですか? =item * =begin original Are Perl regexes DFAs or NFAs? Are they POSIX compliant? =end original Perl の正規表現ルーチンは DFA ですか NFA ですか? また、それは POSIX に従ってますか? =item * =begin original What's wrong with using grep in a void context? =end original 無効コンテキストで grep を使うことのどこが間違っているのでしょうか? =item * =begin original How can I match strings with multibyte characters? =end original マルチバイト文字を含む文字列をマッチングさせるには? =item * =begin original How do I match a regular expression that's in a variable? =end original 変数に入っている正規表現でマッチングを行うには? =back =head2 L: General Perl Language Issues (L: Perl 言語一般に関することがら) =begin original This section deals with general Perl language issues that don't clearly fit into any of the other sections. =end original このセクションでは、他のセクションにはきっちりとあてはまらないような Perl 言語に関する一般的な事柄を扱います。 =over 4 =item * =begin original Can I get a BNF/yacc/RE for the Perl language? =end original Perl のための BNF/yacc/RE は入手できますか? =item * =begin original What are all these $@%&* punctuation signs, and how do I know when to use them? =end original $@%&* のマークはなんですか? これらをいつ使えばいいのかを知るにはどうすればいいですか? =item * =begin original Do I always/never have to quote my strings or use semicolons and commas? =end original 文字列では常にクォートする/決してクォートしない必要があるのでしょうか? また、セミコロンやカンマについては? =item * =begin original How do I skip some return values? =end original 戻り値の一部をスキップするには? =item * =begin original How do I temporarily block warnings? =end original 一時的に警告をブロックするには? =item * =begin original What's an extension? =end original エクステンションてなんですか? =item * =begin original Why do Perl operators have different precedence than C operators? =end original なぜ Perl の演算子は C の演算子とは異なった優先順位を持っているのでしょうか? =item * =begin original How do I declare/create a structure? =end original 構造体を宣言したり生成するには? =item * =begin original How do I create a module? =end original モジュールを作成するには? =item * =begin original How do I adopt or take over a module already on CPAN? =end original すでに CPAN にあるモジュールを引き継ぐには? =item * =begin original How do I create a class? =end original クラスを作るには? =item * =begin original How can I tell if a variable is tainted? =end original 変数が汚染されているかどうかを確かめるには? =item * =begin original What's a closure? =end original クロージャ(closure)ってなんですか? =item * =begin original What is variable suicide and how can I prevent it? =end original 変数の自殺(variable suicide)って何で、それをどうすれば防げますか? =item * =begin original How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}? =end original {関数, ファイルハンドル, 配列, ハッシュ, メソッド, 正規表現} を渡したり返したりするには? =item * =begin original How do I create a static variable? =end original 静的変数を作るには? =item * =begin original What's the difference between dynamic and lexical (static) scoping? Between local() and my()? =end original 動的スコープとレキシカル(または静的)スコープとの間の違いは? local() と my() との違いは? =item * =begin original How can I access a dynamic variable while a similarly named lexical is in scope? =end original どうやれば同じ名前のレキシカル変数がスコープにあるときに動的変数にアクセスできますか? =item * =begin original What's the difference between deep and shallow binding? =end original 深い束縛(deep binding)と浅い束縛(shallow binding)との間の違いとは? =item * =begin original Why doesn't "my($foo) = E$fhE;" work right? =end original なぜ "my($foo) = E$fhE;" が正しく動作しないのでしょうか? =item * =begin original How do I redefine a builtin function, operator, or method? =end original 組み込みの関数や演算子、メソッドを再定義するには? =item * =begin original What's the difference between calling a function as &foo and foo()? =end original 関数呼び出しを &foo で行ったときと foo() で行ったときとの違いはなんですか? =item * =begin original How do I create a switch or case statement? =end original switch 文や case 文を作るには? =item * =begin original How can I catch accesses to undefined variables, functions, or methods? =end original どうすれば未定義な変数, 関数, メソッドに対するアクセスを捕捉できますか? =item * =begin original Why can't a method included in this same file be found? =end original なぜ同じファイルにあるメソッドが見つけられないのでしょうか? =item * =begin original How can I find out my current or calling package? =end original カレントのパッケージや呼び出しパッケージはどうすればわかりますか? =item * =begin original How can I comment out a large block of Perl code? =end original Perl プログラムの大きなブロックをコメントアウトするには? =item * =begin original How do I clear a package? =end original パッケージをクリアするには? =item * =begin original How can I use a variable as a variable name? =end original 変数を変数名として使うには? =item * =begin original What does "bad interpreter" mean? =end original "bad interpreter" とはどういう意味ですか? =back =head2 L: System Interaction (L: システムとの相互作用) =begin original This section of the Perl FAQ covers questions involving operating system interaction. Topics include interprocess communication (IPC), control over the user-interface (keyboard, screen and pointing devices), and most anything else not related to data manipulation. =end original FAQ のこのセクションでは、オペレーティングシステムとの対話に関する質問を 扱っています。 これにはプロセス間(IPC)、ユーザーインターフェース (キーボード、スクリーン、ポインティングデバイス)の制御、 その他データ操作に関連しないほとんどの事柄を含みます。 =over 4 =item * =begin original How do I find out which operating system I'm running under? =end original 実行しているオペレーティングシステムを見分けるには? =item * =begin original How come exec() doesn't return? =end original なぜ exec() は戻ってこないのでしょう? =item * =begin original How do I do fancy stuff with the keyboard/screen/mouse? =end original キーボード/画面/マウスの凝った機能を使うには? =item * =begin original How do I print something out in color? =end original 色付きで何かを出力するには? =item * =begin original How do I read just one key without waiting for a return key? =end original リターンキーを待たずにキーのデータを一つ読み取るには? =item * =begin original How do I check whether input is ready on the keyboard? =end original キーの入力待ちがあるかどうかチェックするには? =item * =begin original How do I clear the screen? =end original 画面をクリアするには? =item * =begin original How do I get the screen size? =end original 画面サイズを得るには? =item * =begin original How do I ask the user for a password? =end original ユーザーにパスワードを尋ねるには? =item * =begin original How do I read and write the serial port? =end original シリアルポートの読み書きを行うには? =item * =begin original How do I decode encrypted password files? =end original 暗号化されたパスワードファイルを復号化するには? =item * =begin original How do I start a process in the background? =end original バックグラウンドでプロセスを起動するには? =item * =begin original How do I trap control characters/signals? =end original 制御文字やシグナルをトラップするには? =item * =begin original How do I modify the shadow password file on a Unix system? =end original UNIX システムのシャドウパスワードファイルを変更するには? =item * =begin original How do I set the time and date? =end original 日付や時刻を設定するには? =item * =begin original How can I sleep() or alarm() for under a second? =end original 一秒未満の時間に対する sleep() や alarm() をするには? =item * =begin original How can I measure time under a second? =end original 1 秒未満の時間を計るには? =item * =begin original How can I do an atexit() or setjmp()/longjmp()? (Exception handling) =end original atexit() や setjmp()/longjmp() をするには? (例外処理) =item * =begin original Why doesn't my sockets program work under System V (Solaris)? What does the error message "Protocol not supported" mean? =end original なぜ私のソケットプログラムはSystem V (Solaris) ではうまく動かないの? "Protocol not supported"というエラーメッセージの意味するところは? =item * =begin original How can I call my system's unique C functions from Perl? =end original Perl から私のシステムに固有の C 関数を呼び出すには? =item * =begin original Where do I get the include files to do ioctl() or syscall()? =end original ioctl() や syscall() で使うための include ファイルはどこで入手できますか? =item * =begin original Why do setuid perl scripts complain about kernel problems? =end original なぜ setuid された perl スクリプトはカーネルの問題について文句を言うのでしょうか? =item * =begin original How can I open a pipe both to and from a command? =end original あるコマンドに対する双方向のパイプをオープンするには? =item * =begin original Why can't I get the output of a command with system()? =end original なぜ system() を使ったコマンドの出力を得ることができないのでしょうか? =item * =begin original How can I capture STDERR from an external command? =end original 外部コマンドの STDERR を捕捉するには? =item * =begin original Why doesn't open() return an error when a pipe open fails? =end original なぜ open() は パイプのオープンに失敗したときにエラーを返さないのでしょうか? =item * =begin original What's wrong with using backticks in a void context? =end original 無効コンテキストで逆クォートを使うことのなにが悪いのでしょうか? =item * =begin original How can I call backticks without shell processing? =end original シェルの処理をせずに逆クォートを呼び出すには? =item * =begin original Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)? =end original なぜ EOF(UNIX での^D、MS-DOS での^Z)を受け取った後で STDIN から読み込むことができないの? =item * =begin original How can I convert my shell script to perl? =end original 私のシェルスクリプトを perl に変換するには? =item * =begin original Can I use perl to run a telnet or ftp session? =end original telnet や ftp のセッションを実行するために perl を使うことができますか? =item * =begin original How can I write expect in Perl? =end original Perl で expect を書くには? =item * =begin original Is there a way to hide perl's command line from programs such as "ps"? =end original “ps”のようなプログラムから、perl のコマンドラインを隠す方法はありますか? =item * =begin original I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible? =end original perl スクリプトの中で、ディレクトリを変更したり環境変数を変更しました。なぜ、スクリプトを終了したときこれらの変更は無効になってしまうの? 変更が反映されるようにするには? =item * =begin original How do I close a process's filehandle without waiting for it to complete? =end original プロセスの完了を待つことなしにそのファイルハンドルをクローズするには? =item * =begin original How do I fork a daemon process? =end original デーモンプロセスを fork() するには? =item * =begin original How do I find out if I'm running interactively or not? =end original 自分が対話的に実行されているかどうかを知るには? =item * =begin original How do I timeout a slow event? =end original 遅いイベントをタイムアウトするには? =item * =begin original How do I set CPU limits? =end original CPU のリミットを設定するには? =item * =begin original How do I avoid zombies on a Unix system? =end original UNIX システムでゾンビを回避するには? =item * =begin original How do I use an SQL database? =end original SQL データベースを使うには? =item * =begin original How do I make a system() exit on control-C? =end original コントロール-C で system() が exit するようにするには? =item * =begin original How do I open a file without blocking? =end original ブロックせずにファイルをオープンするには? =item * =begin original How do I tell the difference between errors from the shell and perl? =end original シェルからと perl からのエラーを見分けるには? =item * =begin original How do I install a module from CPAN? =end original モジュールを CPAN からインストールするには? =item * =begin original What's the difference between require and use? =end original require と use の間の違いとは? =item * =begin original How do I keep my own module/library directory? =end original 自分自身のモジュール/ライブラリディレクトリを持つには? =item * =begin original How do I add the directory my program lives in to the module/library search path? =end original 私のプログラムの置いてある場所をモジュール/ライブラリの検索パスに追加するには? =item * =begin original How do I add a directory to my include path (@INC) at runtime? =end original 実行時にインクルードパス (@INC) にディレクトリを追加するには? =item * =begin original What is socket.ph and where do I get it? =end original socket.ph とは一体何で、それはどこで入手できますか? =back =head2 L: Web, Email and Networking (L: Web、メール、ネットワーク) =begin original This section deals with questions related to running web sites, sending and receiving email as well as general networking. =end original このセクションでは、web サイトの実行、メールの送受信、および一般的な ネットワークに関する質問を扱っています。 =over 4 =item * =begin original Should I use a web framework? =end original web フレームワークを使うべき? =item * =begin original Which web framework should I use? =end original どの web フレームワークを使うべき? =item * =begin original What is Plack and PSGI? =end original Plack と PSGI って何? =item * =begin original How do I remove HTML from a string? =end original ある文字列から HTML を取り除くには? =item * =begin original How do I extract URLs? =end original URL の展開を行うには? =item * =begin original How do I fetch an HTML file? =end original HTML ファイルをフェッチするには? =item * =begin original How do I automate an HTML form submission? =end original HTML フォームの処理を自動化するには? =item * =begin original How do I decode or create those %-encodings on the web? =end original web上で %-encodings をデコードしたり生成したりするには? =item * =begin original How do I redirect to another page? =end original 別のページにリダイレクトするには? =item * =begin original How do I put a password on my web pages? =end original 私の web ぺージでパスワードを入力するには? =item * =begin original How do I make sure users can't enter values into a form that causes my CGI script to do bad things? =end original 私の CGI スクリプトに悪影響をもたらすようなものを、ユーザーがフォームに入力できないようにするには? =item * =begin original How do I parse a mail header? =end original メールのヘッダーを解析するには? =item * =begin original How do I check a valid mail address? =end original メールアドレスが正しいかチェックするには? =item * =begin original How do I decode a MIME/BASE64 string? =end original MIME/BASE64 文字列のデコードを行うには? =item * =begin original How do I find the user's mail address? =end original あるユーザーのメールアドレスを知るには? =item * =begin original How do I send email? =end original メールを送るには? =item * =begin original How do I use MIME to make an attachment to a mail message? =end original メールメッセージに添付するためにどうやって MIME を使えばいいですか? =item * =begin original How do I read email? =end original メールを読み出すには? =item * =begin original How do I find out my hostname, domainname, or IP address? =end original 私のホスト名/ドメイン名/IP アドレスを見つけるには? =item * =begin original How do I fetch/put an (S)FTP file? =end original (S)FTP ファイルをダウンロード/アップロードするには? =item * =begin original How can I do RPC in Perl? =end original Perl で RPC を行うには? =back =head1 CREDITS Tom Christiansen wrote the original perlfaq then expanded it with the help of Nat Torkington. brian d foy substantialy edited and expanded the perlfaq. perlfaq-workers and others have also supplied feedback, patches and corrections over the years. =head1 AUTHOR AND COPYRIGHT Tom Christiansen wrote the original version of this document. brian d foy C<< >> wrote this version. See the individual perlfaq documents for additional copyright information. This document is available under the same terms as Perl itself. Code examples in all the perlfaq documents are in the public domain. Use them as you see fit (and at your own risk with no warranty from anyone). =begin meta Translate: 吉村 寿人 Update: SHIRAKATA Kentaro (5.6.1-5.14.1, 5.00150039) Status: completed =end meta