開発環境
- OS X Lion - Apple(OS)
- BBEdit - Bare Bones Software, Inc., Emacs(Text Editor)
- プログラミング言語: Perl
『続・初めてのPerl 改訂版』(Randal L. Schwartz, brian d foy, Tom Phoenix 著、伊藤 直也、田中 慎司、吉川 英興 監訳、株式会社ロングテール/長尾 高弘 訳、オライリー・ジャパン、2006年、ISBN4-87311-305-9)の2章(中級者の基礎知識)の2.4(練習問題)1を解いてみる。
その他参考書籍
1.
コード(BBEdit)
sample.pl
#!/usr/bin/env perl use strict; use warnings; use 5.016; use utf8; binmode STDOUT, ':utf8'; binmode STDIN, ':utf8'; binmode STDERR, ':utf8'; print map { " $_\n"; } grep { -s $_ < 1000; } @ARGV;
入出力結果(Terminal)
$ ./sample.pl * Ginger: Lovey: MaryAnn: MonkeyMan: Oogaboogoo Professor: Thurston: __pycache__ barney betty date.log date.txt fred gilligan.info ginger.info hello_world.pl html link_test ln.txt ln1.txt log lovey.info maryann.info monkeyman.info numbers perl_program1 professor.info sample sample.pl sample.py sample.txt sample_folder skipper.info some_file some_folder sortable_hash standings.db test.out test.py test.txt test.txt.out test_folder test_link thurston.info tmp.txt tmp1.txt tmp2.txt untitled text 2.txt $
ちなみにpython3.3の場合。
コード(BBEdit)
sample.py
#!/usr/bin/env python3.3 ## Copyright (C) 2013 by kamimura #-*- coding: utf-8 -*- import glob, os print("".join(list(map(lambda x: " {0}\n".format(x), filter(lambda x: os.stat(x).st_size < 1000, sorted(glob.glob("*")))))), end="")
入出力結果(Terminal)
$ ./sample.py Ginger: Lovey: MaryAnn: MonkeyMan: Oogaboogoo Professor: Thurston: __pycache__ barney betty date.log date.txt fred gilligan.info ginger.info hello_world.pl html link_test ln.txt ln1.txt log lovey.info maryann.info monkeyman.info numbers perl_program1 professor.info sample sample.pl sample.py sample.txt sample_folder skipper.info some_file some_folder sortable_hash standings.db test.out test.py test.txt test.txt.out test_folder test_link thurston.info tmp.txt tmp1.txt tmp2.txt untitled text 2.txt $
0 コメント:
コメントを投稿