perlcheat - Perl 5 Cheat Sheet

目次


NAME 名前

perlcheat - Perl 5 Cheat Sheet

perlcheat - Perl 5 カンニングペーパー


DESCRIPTION 説明

This 'cheat sheet' is a handy reference, meant for beginning Perl programmers. Not everything is mentioned, but 194 features may already be overwhelming.

この 'カンニングペーパー(cheat sheet)' は Perl プログラマのための ハンドブックです. すべてが説明されている訳ではありませんが, 194 もの機能が記載されています.

The sheet シート

  コンテキスト 変数記号(SIGIL)       配列          ハッシュ
  void         $scalar         全て: @array        %hash
  スカラー     @array      スライス: @array[0, 2]  @hash{'a', 'b'}
  リスト       %hash           要素: $array[0]     $hash{'a'}
               &sub
               *glob     スカラー値
                         数値, 文字列, リファレンス, グロブ, 未定義値
  リファレンス
  \     リファレンス        $$foo[1]       別記法 $foo->[1]
  $@%&* デリファレンス      $$foo{bar}     別記法 $foo->{bar}
  []    無名. 配列ref       ${$$foo[1]}[2] 別記法 $foo->[1]->[2]
  {}    無名. ハッシュref   ${$$foo[1]}[2] 別記法 $foo->[1][2]
  \()   リファレンスのリスト
                          数値   対  文字列        参考リンク
  演算子優先順位          =          =             perl.plover.com
  ->                      +          .             search.cpan.org
  ++ --                   == !=      eq ne         cpan.org
  **                      < > <= >=  lt gt le ge   pm.org
  ! ~ \ u+ u-             <=>        cmp           tpj.com
  =~ !~                                            perldoc.com
  * / % x                 構文
  + - .                   for    (リスト) { }, for (a;b;c) { }
  << >>                   while  ( ) { }, until ( ) { }
  名前付単項演算子        if     ( ) { } elsif ( ) { } else { }
  < > <= >= lt gt le ge   unless ( ) { } elsif ( ) { } else { }
  == != <=> eq ne cmp     for と foreach は同じ(常に)
  &
  | ^              正規表現記述               正規表現修飾子
  &&               ^     文字列の最初         /i 大文字小文字を無視
  ||               $     文字列の末尾(\nの前) /m ^$ を行ベースに
  .. ...           +     1つ以上             /s . に \n を含める
  ?:               *     0以上               /x 空白を無視
  = += -= *= etc.  ?     0か1つ             /g グローバル
  , =>             {3,7} 範囲内で繰り返し
  list ops         ()    キャプチャ       正規表現文字クラス
  not              (?:)  キャプチャなし   .  == [^\n]
  and              []    文字クラス       \s == [\x20\f\t\r\n]
  or xor           |     選択             \w == [A-Za-z0-9_]
                   \b    文字境界         \d == [0-9]
                   \z    文字列の末尾     \S, \W, \D はその反転
  すべき
  use strict;        やらないべき     参考リンク
  use warnings;      "$foo"           perl.com
  my $var;           $$variable_name  perlmonks.org
  open() or die $!;  `$userinput`     use.perl.org
  use Modules;       /$userinput/     perl.apache.org
                                      parrotcode.org
  関数の復帰値
  stat      localtime    caller         特殊変数
   0 dev    0 second     0 package      $_    デフォルト変数
   1 ino    1 minute     1 filename     $0    プログラム名
   2 mode   2 hour       2 line         $/    入力区切り
   3 nlink  3 day        3 subroutine   $\    出力区切り
   4 uid    4 month-1    4 hasargs      $|    自動フラッシュ
   5 gid    5 year-1900  5 wantarray    $!    システム/ライブラリ呼び出しエラー
   6 rdev   6 weekday    6 evaltext     $@    eval エラー
   7 size   7 yearday    7 is_require   $$    プロセスID
   8 atime  8 is_dst     8 hints        $.    行番号
   9 mtime               9 bitmask      @ARGV コマンドライン引数
  10 ctime  POSIX::        3..9 は      @INC  include パス
  11 blksz  strftimeを     EXPR を渡し  @_    関数引数
  12 blcks  使いましょう!  た時のみ     %ENV  環境変数

ACKNOWLEDGEMENTS 謝辞

The first version of this document appeared on Perl Monks, where several people had useful suggestions. Thank you, Perl Monks.

このドキュメントの最初のバージョンは多くの人々が役立つ提案を行っている Perl Monks にありました. Perl Monks ありがとう.

A special thanks to Damian Conway, who didn't only suggest important changes, but also took the time to count the number of listed features and make a Perl 6 version to show that Perl will stay Perl.

特に重要な変更を提案するだけでなく機能の数を数える時間をとってくれたり, Perl 6 版をつくってくれた Damian Conway に感謝します.


AUTHOR 著者

Juerd Waalboer <juerd@cpan.org>, with the help of many Perl Monks.

Juerd Waalboer <juerd@cpan.org>, 多くの Perl Monk 達の助けと共に.


SEE ALSO 関連項目

 http://perlmonks.org/?node_id=216602      the original PM post
 http://perlmonks.org/?node_id=238031      Damian Conway's Perl 6 version
 http://juerd.nl/site.plp/perlcheat        home of the Perl Cheat Sheet

 http://perlmonks.org/?node_id=216602      オリジナルの投稿.
 http://perlmonks.org/?node_id=238031      Damian Conway による Perl 6 版.
 http://juerd.nl/site.plp/perlcheat        Perl カンニングペーパーのホーム.

TRANSALTE TO JAPANESE 和訳

 山科 氷魚 (YAMASHINA Hio) <hio@hio.jp>

Origlnal distribution is perl VERSION 5.8.8. Translated at 2007-03-11.

原典: perl VERSION 5.8.8. 翻訳日: 2007-03-11.

perlcheat - Perl 5 Cheat Sheet

索引

perlcheat - Perl 5 Cheat Sheet