2019年1月19日土曜日

開発環境

初めてのPerl 第7版 (Randal L. Schwartz(著)brian d foy(著)Tom Phoenix(著)近藤 嘉雪(翻訳)嶋田 健志(翻訳)オライリージャパン)の1章(Perl入門)、1.6(練習問題)2、3の解答を求めてみる。

コード

Perl

#!/usr/bin/env perl
@lines = `perldoc -u -f atan2`;
for (@lines) {
    s/\w<([^>]+)>/\U$1/g;
    print;
}

入出力結果(cmd(コマンドプロンプト)、Terminal)

$ perldoc -u -f atan2 > output1.txt
$ perl sample3.pl > output2.txt
$ diff output1.txt output2.txt > output3.txt
$ cat output1.txt 
=over 8

=item atan2 Y,X
X<atan2> X<arctangent> X<tan> X<tangent>

=for Pod::Functions arctangent of Y/X in the range -PI to PI

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

For the tangent operation, you may use the
L<C<Math::Trig::tan>|Math::Trig/B<tan>> function, or use the familiar
relation:

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

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

Portability issues: L<perlport/atan2>.

=back
$ cat output2.txt 
=over 8

=item atan2 Y,X
ATAN2 ARCTANGENT TAN TANGENT

=for Pod::Functions arctangent of Y/X in the range -PI to PI

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

For the tangent operation, you may use the
C<MATH::TRIG::TAN|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.

Portability issues: PERLPORT/ATAN2.

=back
$ cat output3.txt 
4c4
< X<atan2> X<arctangent> X<tan> X<tangent>
---
> ATAN2 ARCTANGENT TAN TANGENT
11c11
< L<C<Math::Trig::tan>|Math::Trig/B<tan>> function, or use the familiar
---
> C<MATH::TRIG::TAN|Math::Trig/TAN> function, or use the familiar
16,17c16,17
< The return value for C<atan2(0,0)> is implementation-defined; consult
< your L<atan2(3)> manpage for more information.
---
> The return value for ATAN2(0,0) is implementation-defined; consult
> your ATAN2(3) manpage for more information.
19c19
< Portability issues: L<perlport/atan2>.
---
> Portability issues: PERLPORT/ATAN2.
$ 

0 コメント:

コメントを投稿

関連コンテンツ