我刚开始学习 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