perl如何判断一个字符串的编码类型
答案:1 悬赏:0 手机版
解决时间 2021-01-03 08:51
- 提问者网友:世勋超人
- 2021-01-03 05:58
perl如何判断一个字符串的编码类型
最佳答案
- 五星知识达人网友:佘樂
- 2021-01-10 05:36
perldoc -f ref
ref EXPR
ref Returns a non-empty string if EXPR is a reference, the empty string otherwise. If EXPR is not specified, $_ will be used. The value
returned depends on the type of thing the reference is a reference to. Builtin types include:
SCALAR
ARRAY
HASH
CODE
REF
GLOB
LVALUE
If the referenced object has been blessed into a package, then that package name is returned instead. You can think of "ref" as a
"typeof" operator.
if (ref($r) eq "HASH") {
print "r is a reference to a hash.\n";
}
unless (ref($r)) {
print "r is not a reference at all.\n";
}
if (UNIVERSAL::isa($r, "HASH")) { # for subclassing
print "r is a reference to something that isa hash.\n";
}
See also perlref.
ref EXPR
ref Returns a non-empty string if EXPR is a reference, the empty string otherwise. If EXPR is not specified, $_ will be used. The value
returned depends on the type of thing the reference is a reference to. Builtin types include:
SCALAR
ARRAY
HASH
CODE
REF
GLOB
LVALUE
If the referenced object has been blessed into a package, then that package name is returned instead. You can think of "ref" as a
"typeof" operator.
if (ref($r) eq "HASH") {
print "r is a reference to a hash.\n";
}
unless (ref($r)) {
print "r is not a reference at all.\n";
}
if (UNIVERSAL::isa($r, "HASH")) { # for subclassing
print "r is a reference to something that isa hash.\n";
}
See also perlref.
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯