私はperlの学習を始めたばかりで、私の本のサンプルコードには次の行があります。
#!/usr/bin/perl
@lines = `perldoc -u -f atan2`;
foreach (@lines) {
s/\w<([^>]+)>/\U$1/g;
print;
}
コードは機能しますが、それは問題ではありません。また、入力と出力を観察することにより、この行がわかります。
s/\w<([^>]+)>/\U$1/g;
これを行います
ATAN2 ARCTANGENT TAN TANGENT <--- X<atan2> X<arctangent> X<tan> X<tangent>
この
MATH::TRIG::TAN <------- C<Math::Trig::tan>
私の質問は、XとCはどこから来たのかということです。
参考までに:コードを使用しない場合の出力は次のとおりです。
perldoc -u -f atan2
=over 8
=item atan2 Y,X
X<atan2> X<arctangent> X<tan> X<tangent>
Returns the arctangent of Y/X in the range -PI to PI.
For the tangent operation, you may use the C<Math::Trig::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 atan2(3) manpage for more information.
=back
そして、これがコードからの完全な出力です:
[/cygdrive/c/Users/Documents/learn_perl]$ ./hello_world.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