開発環境
- macOS Mojave - Apple (OS)
- Emacs (Text Editor)
- Windows 10 Pro (OS)
- Strawberry Perl (WindowsのPerlの言語処理系)
- Visual Studio Code (Text Editor)
- Perl 5.28 (プログラミング言語)
初めてのPerl 第7版 (Randal L. Schwartz(著)、brian d foy(著)、Tom Phoenix(著)、近藤 嘉雪(翻訳)、嶋田 健志(翻訳)、オライリージャパン)の1章(Perl入門)、1.6(練習問題)1、2、3の解答を求めてみる。
コード
#!/usr/bin/env perl
use strict;
use warnings;
use v5.28;
say "1.\nHello, world!";
say '3.';
# こちらだとこのプログラムと同様に
# Encode.c: loadable library and perl binaries are mismatched
# (got handshake key 0xdb00080, needed 0xc500080)
# となったから、macOSに標準搭載のperldocを使うように変更
# my @lines = `perldoc -u -f atan2`;
my @lines = `/usr/bin/perldoc -u -f atan2`;
for (@lines) {
s/\w<([^>]+)>/\U$1/g;
print;
}
入出力結果(Zsh、PowerShell、Terminal)
% chmod a+x sample1.pl
% ./sample1.pl
Perl v5.28.0 required--this is only v5.18.4, stopped at ./sample1.pl line 4.
BEGIN failed--compilation aborted at ./sample1.pl line 4.
% ./sample1.pl
1.\nHello, world!
3.
Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xc500080)
% ./sample1.pl
1.
Hello, world!
3.
Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xc500080)
% ./sample1.pl
Perl v5.24.0 required--this is only v5.18.4, stopped at ./sample1.pl line 4.
BEGIN failed--compilation aborted at ./sample1.pl line 4.
% port installed | grep perl
ossp-uuid @1.6.2_11+perl5_28 (active)
perl5 @5.26.1_0+perl5_28 (active)
perl5.28 @5.28.2_2 (active)
% ./sample1.pl
1.
Hello, world!
3.
Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xc500080)
% perldoc -u -f atan2
Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xc500080)
% /usr/bin/perldoc -u -f atan2
% ./sample1.pl
1.
Hello, world!
3.
=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.
OR THE TANGENT OPERATION, YOU MAY USE THE C<MATH::TRIG::TAN
function, or use the familiar relation:
sub tan { sin($_[0]) / cos($_[0]) }
HE RETURN VALUE FOR C<ATAN2(0,0) is implementation-defined; consult
your atan2(3) manpage for more information.
ORTABILITY ISSUES: L<PERLPORT/ATAN2.
=back
% ./sample1.pl
1.
Hello, world!
3.
=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 <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
% ./sample1.pl
1.
Hello, world!
3.
=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 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
%
「Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xc500080)」を検索してみたら、過去にcpanを使用てから何か問題が起きたっぽいけど、とりあえず先に進むことに。
0 コメント:
コメントを投稿