2012年8月23日木曜日

開発環境

『初めてのPerl 第6版』(Randal L. Schwartz, Tom Phoenix, brian d foy 共著、近藤 嘉雪 訳、オライリー・ジャパン、2012年、ISBN978-4-87311-567-2) の5章(入出力)、5.13(練習問題)2を解いてみる。

2.

コード(TextWrangler)

sample.pl

#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.012;
binmode STDOUT, ':encoding(UTF-8)';
binmode STDIN, ':encoding(UTF-8)';

chomp(my @lines = <STDIN>);
print "1234567890" x 6 . "\n";
for(@lines){
  printf "%20s\n",$_;
}

入出力結果(Terminal)

$ ./sample.pl
hello
good-bye
123456789012345678901234567890123456789012345678901234567890
               hello
            good-bye
$

0 コメント:

コメントを投稿