$>和$?在 Perl 中
在 Perl 中,$>
和 $?
是否具有特殊含义,就像 $_
和 @_
一样> “特别”吗?
In Perl, do $>
and $?
have special meaning in the same way that $_
and @_
are "special"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,有许多名称为单个标点符号的特殊变量,包括标量变量
>
(写作$>
)和标量变量?< /code>(写作
$?
)。它们记录在perldoc perlvar
中。$>
是进程的有效用户 ID 。它的“神奇”之处在于对其进行分配会更改 EUID(如果允许)。$?
包含最后一个外部的状态进程调用。它有点神奇(例如你只能给它分配整数),但主要是几个内置的构造(例如反引号,即`foo`
)分配给它。Yes, there are many special variables whose name is a single punctuation character, including the scalar variable
>
(written$>
) and the scalar variable?
(written$?
). They are documented inperldoc perlvar
.$>
is the process's effective user ID. It's “magical” in that assigning to it will change the EUID (if permitted).$?
contains the status of the last external process call. It's a little magical (e.g. you can only assign integers to it), but mainly several built-in constructs (such as backticks, i.e.`foo`
) assign to it.