开发者

$> and $? in Perl

In Perl, do $> and $? have special meaning in the same way that $_ and @_ are "spec开发者_StackOverflow中文版ial"?


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 in perldoc 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜