2012年5月7日月曜日

開発環境

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

3.

やり方の1つ。(「やり方は何通りもある」(TIMTOWTDI(There Is More Than One Way To Do It.)))

コード(TextWrangler)

#!/usr/bin/env perl
use strict;
use warnings;

my @lines = `perldoc -u -f atan2`;
foreach(@lines){
  s/\w<([^>]+)>/\U$1/g;
  print;
}

入出力結果(Terminal)

$ perl sample.pl
=over 8

=item atan2 Y,X
ATAN2 ARCTANGENT TAN TANGENT

Returns the arctangent of Y/X in the range -PI to PI.

For the tangent operation, you may use the MATH::TRIG::TAN
function, or use the familiar relation:

    sub tan { sin($_[0]) / cos($_[0])  }

The return value for ATAN2(0,0) is implementation-defined; consult
your atan2(3) manpage for more information.

=back
$

0 コメント:

コメントを投稿