開発環境
- OS X Lion - Apple(OS)
- TextWrangler(Text Editor) (BBEditの機能制限無料版、light版)
- Script言語:Perl
『続・初めてのPerl 改訂版』(Randal L. Schwartz, brian d foy, Tom Phoenix 著、伊藤 直也、田中 慎司、吉川 英興 監訳、株式会社ロングテール/長尾 高弘 訳、オライリー・ジャパン、2006年、ISBN4-87311-305-9) の2章(中級者の基礎知識), 2.4(練習問題)1を解いてみる。
1.
やり方の1つ。(「やり方は何通りもある」(TIMTOWTDI(There Is More Than One Way To Do It.)))
コード(TextWrangler)
#!/usr/bin/env perl use strict; use warnings; print map {" $_\n"} grep {-s $_ < 1000} @ARGV;
入出力結果(Terminal)
$ ./sample.pl * ls.err ls.out numbers perl_program.bak.bak perl_program.pl perl_program1 perl_program1.bak sample.bak sample.pl sample_folder sortable_hash test test.bak test_folder test_link test_new $ ls -l total 192 -rw-r--r-- 1 kamimura staff 65 4 12 15:59 ls.err -rw-r--r-- 1 kamimura staff 0 4 12 15:59 ls.out -r-------- 1 kamimura staff 88 6 10 2001 numbers -rw-r--r--@ 1 kamimura staff 5389 4 14 16:44 perl_kamimura_blog -rwxr-xr-x@ 1 kamimura staff 154 3 18 16:05 perl_program.bak.bak -rwxr-xr-x 1 kamimura staff 194 3 18 16:09 perl_program.pl -rwxr-xr-x@ 1 kamimura staff 290 3 19 16:10 perl_program1 -rwxr-xr-x@ 1 kamimura staff 289 3 19 16:09 perl_program1.bak -rw-r--r--@ 1 kamimura staff 124 3 15 16:56 sample.bak -rwxr-xr-x@ 1 kamimura staff 96 4 15 15:57 sample.pl drwxr-xr-x 3 kamimura staff 102 4 1 15:14 sample_folder -r-------- 1 kamimura staff 5563 3 18 16:09 sample_text -r-------- 1 kamimura staff 5563 6 10 2001 sample_text.bak -rw-r--r-- 1 kamimura staff 5576 3 18 16:09 sample_text.out -rw-r--r-- 1 kamimura staff 5576 3 17 16:08 sample_text.out.bak -r-------- 1 kamimura staff 362 6 10 2001 sortable_hash -rw-r--r-- 2 kamimura staff 330 3 18 16:09 test -rw-r--r--@ 1 kamimura staff 330 3 9 14:46 test.bak drwxr-xr-x 3 kamimura staff 102 4 1 15:16 test_folder -rw-r--r-- 2 kamimura staff 330 3 18 16:09 test_link lrwxr-xr-x 1 kamimura staff 4 4 1 15:15 test_new -> test $
0 コメント:
コメントを投稿