加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何获取Perl中的字符串的长度?

发布时间:2020-12-15 21:25:59 所属栏目:大数据 来源:网络整理
导读:什么是perl等价于strlen()? 解决方法 perldoc -f length length EXPR length Returns the length in characters of the value of EXPR. If EXPR is omitted,returns length of $_. Note that this cannot be used on an entire array or hash to find out h
什么是perl等价于strlen()?

解决方法

perldoc -f length

   length EXPR
   length  Returns the length in characters of the value of EXPR.  If EXPR is
           omitted,returns length of $_.  Note that this cannot be used on an
           entire array or hash to find out how many elements these have.  For
           that,use "scalar @array" and "scalar keys %hash" respectively.

           Note the characters: if the EXPR is in Unicode,you will get the num-
           ber of characters,not the number of bytes.  To get the length in
           bytes,use "do { use bytes; length(EXPR) }",see bytes.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读