毎秒2000Requestを捌くPerl製CMSの内部構造(Debianサーバ1台にて) from nabe-abk www.slideshare.net
Perl › 関数 › here oct関数を使用すると8進数文字列を10進数の数値に変換することができます。 8進数から10進数への変換 8進数から10進数へ変換するにはoct関数を使用します。 my $digit = oct('755'); 8進数の755は10進数の493になります。 上のサンプルでは'755'を渡していますが'0755'のように先頭に0がついていても正しく変換されます。 2進数から10進数への変換 oct関数を使って、2進数文字列を10進数の数値に変換することもできます。oct関数は本来は8進数を10進数に変換する関数ですが、0bが先頭についた文字列を引数として渡した場合は、2進数文字列を10進数の数値に変換します。 my $digit = oct('0b101'); 進数変換についてもう少し詳しく 16進数から10進数に変換するにはhex関数を使うことができます。
技術評論社さんからPerlの新刊が出たようなので、紹介。著者は、高橋順子さん。女性の方だ。2017年10月24日発売。 かんたんIT基礎講座シリーズ Perlではじめる プログラミング超入門 「かんたんIT基礎講座」シリーズのPerl入門書で,2011年発売の「ゼロからわかるPerl言語超入門」の改訂版にあたります。Perlをテーマに,プログラミングの技術をゼロから身につけられます。作例として簡単なゲームを作るなど,楽しみながら学習できる内容にもなっています。また,各章末には練習問題を用意しており,取り外し可能な解答集も付属しています。独習用のテキストにはもちろん,授業や講座などのテキストとしてもお勧めです。 書泉ブックタワーコンピュータ書売り場の様子。 目次 Perlの基礎が網羅されている。 CHAPTER 1 Perlの概要 1-1 プログラミングとは何か 1-2 Perlとは何か 1
Perl入学式in東京での2017年度11月から2018年3月までの「後期」カリキュラムは、2017年4月から8月までの「前期」カリキュラムと同一です。前期に出席した方が後期に参加することは全く問題ありませんが、カリキュラムが同一であることはご留意下さい。 Perl入学式って? 「プログラミングに興味があるけど, ちょっと難しそう...」と思っている貴方! 「他の言語使いだけど, ちょっとPerlも使ってみよっかな?」と思っている貴方! 「仕事や研究でPerlを使い始めたけど, ちょっと自信ないな...」と思っている貴方! 「プログラミング未経験者」から「Perl初心者」を対象としたワークショップ, 「Perl入学式」で一緒にPerlで学びましょう! プログラミングの「プ」の字も知らないあなたでも大丈夫. 経験豊富な講師とサポーターが, あなたの学びを全力でサポートします. さあ, 私達と
Perlの数値計算を速くするために、研究・開発しているSPVMプロジェクト。現在は、バイトコード実装なのですが、もうすこしで、JIT実装を始められそう。実行時にコンパイルして、すべてを機械語にする。 目標はC言語のパフォーマンス 目標はC言語で「-O3」で最適化したときのパフォーマンスだ。このパフォーマンスを出すことができれば目標達成。 実装を始めると必ず困難にぶつかるけれど、現在の予想として、十分可能だと感じている。 その理由は、 SPVMは型と関数がコンパイル時に完全に決定される それゆえ、完全なC言語のソースコードにトランスパイルできる そのソースコードを「-O3」でコンパイルできる 完全にC言語にトランスパイルできるとしたら、インライン展開、定数伝播、レジスタ割り当てや、ループ最適化などの非常に難しい最適化をgccに任せることができる。 Perlには「ExtUtils::CBuil
イベント内容 ※画像はイメージです。 内容 Perlで何か作る勉強会です。 お題(ネタ)は各自で用意してきてください。 特にネタがない方は「CPANモジュールガイド」からモジュールを選んで、何か動くものを作ってみましょう。 最後に1人あたり3分程度で、成果を発表しましょう。 参加お申し込みについて 会場への入場をスムーズにするため、アンケートの入力にご協力ください。 会場のナレッジサロンを使用する際に「本名」および「電話番号または会社(学校)名」必要になりますので、ご協力のほどよろしくお願いいたします。 プライバシーポリシー - KNOWLEDGE CAPITAL|ナレッジキャピタル 会場 プロジェクトルームE 禁止事項 会場は会員制のサロンのため、飲食物の持ち込みは出来ません。ご協力をお願いいたします。 会場にバーカウンターがございますので、ドリンクなどはこちらでご購入ください。 注意事
エックスサーバーにMovable Typeをインストールすると、画像のアップロードに失敗します。 他のサーバーから、既にアップロード画像が含まれているMTを移行した場合、管理画面の「アイテム > 一覧」に入った途端に500エラーとなります。 これは、MTで画像処理の標準となっているモジュールが、エックスサーバーではインストールされていないためです。 これは、エックスサーバーではOpenMPでの高速化を行っているのに対し、ImageMagickのマルチスレッド処理に不具合があることが原因と考えられています。 この件についても後述します。 最速の対応 /MTをインストールしたパス/mt-config.cgi をテキストエディタで開き、環境変数の「ImageDriver」をコメントアウトして「GD」に書き換えてください。 エックスサーバーには「Image::Magick」「Imager」はありま
ラリー・ウォール氏によって1987年に開発されたスクリプト言語です。 C言語、AWK、sed, sh などの影響を受けて開発され、PHP, Ruby, Python などに影響を与えました。 聖書の中の「高度な真珠」にちなんで pearl と名付けられる予定でしたが、同盟の言語がすでに存在したため Perl と名づけられました。 現在では Perl は "Practical Extraction and Report Language" の略とされています。 プログラミング言語を示すときは先頭大文字で「Perl」、処理系を表すときは先頭小文字で「perl」と表します。 2023年9月現在、5.38 が最新版です。 RHEL7系では 5.16、RHEL8系では 5.26、RHEL9系では 5.32、Ubuntu 22.04では 5.34 がインストールされます。 Windows用の実装として
SSAライブのダブルアンコールを諦めて、泣く泣く帰ってた名古屋の皆さん!!!リニアは!!!あなたのダブルアンコールを!!!諦めません!!! ↑これくらいしないと夢のようだ!って実感できないよな… twitter.com/lu_narn/status… — 添川 (@soekawaarit0) 2017年10月26日 - 22:23 これも「小野寺、故障の原因が不明な米軍ヘリの飛行再開を追認」って書いて欲しいよな…防衛省って書くからニュースが分かりにくくなる。 twitter.com/kyodo_official… — 添川 (@soekawaarit0) 2017年10月26日 - 22:30 そりゃ小選挙区で赤嶺さん勝つよなーと思いました。共産党は沖縄の民意を反映できるよう頑張って下さいね。 twitter.com/koike_akira/st… — 添川 (@soekawaarit0)
use strict; use warnings; # コンテキスト(代表的ハマりポイント!!!!) my @hoge = (3, 0, 1, 2); my ($ans) = @hoge; print $ans."\n"; #3 配列へ代入すると0番目のみ代入される my $ans2 = @hoge; print $ans2."\n"; #4 配列はスカラコンテキストでで評価すると長さが返される。 print $#hoge."\n"; #4 末尾の添字が表示されます ## 配列の操作 #my @array = ('a', 'b', 'c', 'd'); #### 記号の使い方!!!!! ### リファレンスの取得作成(配列) my @x = (1, 2, 3); my $ref_x1 = \@x; # 略記 my @ref_x2 = [1, 2, 3]; my $ref_x3 = [@x]
<Perlスクリプトは常にScriptファイル実装するとは限らない> 例えば、以下のようなファイル処理 ――――――――――――――――― 1.入力ファイルの0バイトから10バイ トをそのまま出力。 2.出力ファイルの11バイト目から "ABCDEF"を固定出力。 3.入力ファイルの20バイトから10 バイトを出力ファイルの17バイ ト目から出力。 ――――――――――――――――― このような単純仕様は、以下のような PerlScriptとなるが、この程度の単純 Scriptは、シェル内に直記述するほう がオープンで保守しやすい。 Scriptファイルにしてしまうと必ず、 その保守の問題が発生するのでシェル の保守と一体化するほうが明示的とい える。しかし1行が長くなりすぎるよ うなScriptになるとシェルそのものの 保守の問題になりかねないので、その 匙かげんを見極める必要がありそう
がっつりPerlを書く機運が高まってきたので、基礎文法を殴り書きでメモすることにした。 _人人人人人人人_ > 突然のPerl <  ̄Y^Y^Y^Y^Y^Y ̄ use strict; use warnings; #[1] 変数 データ(スカラー値、配列、ハッシュ) ## (1)スカラー(単一の値: 数値、文字列) 変数 : $ my $msg = "hello world\n"; print $msg; my $x = 10; my $y = 10.7; my $z = 123_456_789; ## (2)配列変数 : @ my @sales = (150, 200, 300); # 同じ意味です my @colors = ('red', 'green'); my @colors2 = qw(red green); #クローテッドワード # 1から100まで my @inc = (1..
Perl Hackers Hub 第45回Perlで作るコマンドラインツール―オプション、サブコマンド、設定ファイルへの対応(2) 前回の(1)はこちらから。 設定ファイルの利用 ここでは、Perlを使って設定ファイルの読み込みを行う手法について紹介していきます。 設定ファイルはなぜ必要か コマンドラインツールでは、実行するたびに変わってくるものがあります。たとえば実行結果をメールで送信するツールなら、メールアドレスは実行ユーザーごとに変わりますし、同じユーザーでも常用しているメールアドレスが変更になった場合は変える必要があります。ファイルを変換するツールなら、どのファイルを変換するのかやファイルの保存場所が毎回変わります。こういった値は、コードに直接書くのではなく、設定値としてプログラムの外部から渡せるようになっているのが良いプログラムです。 設定値を渡す方法として、すでにコマンドライン
ドトール専用のものは退役昨日2017/10/18の記事で紹介した、ドトールバリューカードのポイント数を、サーバ管理・監視ツールのMackerelに投稿するために作った自作Perlスクリプト「dvc2mackerel.pl」、いきなりですが更新終了とし、退役させます。 どうせなら各種カード対応型を作るなぜかというと、今日仕事の後にタリーズでまったりお茶していた際、1) タリーズカードにも対応させたくなり、2) それならば他の様々なカードにも対応できるよう、プログラムのコアは共通化して処理系を拡張しやすい形で作り直すべき!と閃いたためです。 今回産まれた、各種カード対応型のPerlスクリプトの名前は「point2mackerel.pl」。GitHubページ https://github.com/mah-jp/point2mackerel で公開しはじめましたので、利用したい方はGitHubペー
まずは、Audrey さんが言った Haskell の殺し文句を思い出して頂きたい。 正規表現ベースのパーサはメンテナンスしにくいのに気づいた? Parsec を使って 15分で Perl6 の完全なパーサを書く方法を勉強しましょう。 15分というのは誇張が入っていると思うが、正規表現が保守しにくく、Haskell の Parsec は強力で保守し易いのは事実だ。その理由を Perl と Haskell のコードを示しながら説明してみたいと思う。 Perl を愛する方に:この記事は Perl を攻撃するために書いたのではない。Perl を選んだのは、正規表現を広めた言語であり、僕がそれなりに Perl のコードを書けるためである。この記事の目的は、正規表現よりも関数型パーサー(Parsec)の方が優れていると示すことだ。 例題 この記事では例題として、IPv4 アドレスを解析する関数を書く
Perl Hackers Hub 第45回Perlで作るコマンドラインツール―オプション、サブコマンド、設定ファイルへの対応(1) 本連載では第一線のPerlハッカーが回替わりで執筆していきます。今回のハッカーはふしはらかんさんで、テーマは「Perlで作るコマンドラインツール」です。 本稿のサンプルコードは、本誌サポートサイトから入手できます。 コマンドラインツールを作ろう 本連載を読まれているみなさんは、コマンドラインツールを使ったことのある人がほとんどかと思います。また、コマンドラインツールを作ったことのある人も多いでしょう。Perlはほとんどの環境に標準で導入されていて、強力なテキスト処理を備えていることもあり、シェルスクリプトで書くのはしんどいかなという程度のものから、かなり複雑で高負荷な処理を要するものまで、幅広くコマンドラインツールの記述に使われています。 今回は、コマンドライ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く