$var = 500 和 $var = '500' 之间的差异 [英] Difference between $var = 500 and $var = '500'

查看:88
本文介绍了$var = 500 和 $var = '500' 之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Perl中,有什么区别

In Perl, what is the difference between

$status = 500;

$status = '500';

推荐答案

不多.他们都为 $status 分配了五百.最初使用的内部格式会有所不同(IV 与 PV,UTF8=0),但这对 Perl 来说并不重要.

Not much. They both assign five hundred to $status. The internal format used will be different initially (IV vs PV,UTF8=0), but that's of no importance to Perl.

然而,根据存储格式的选择,有些东西的行为会有所不同,即使它们不应该.基于存储格式的选择,

However, there are things that behave different based on the choice of storage format even though they shouldn't. Based on the choice of storage format,

  • JSON 决定是否使用引号.
  • DBI 猜测它应该用于参数的 SQL 类型.
  • 按位运算符(&|^)猜测它们的操作数是否是字符串.
  • open 和其他与文件相关的内置函数是否使用 UTF-8 对文件名进行编码.(错误!)
  • 某些数学运算是否返回负零.
  • JSON decides whether to use quotes or not.
  • DBI guesses the SQL type it should use for a parameter.
  • The bitwise operators (&, | and ^) guess whether their operands are strings or not.
  • open and other file-related builtins encode the file name using UTF-8 or not. (Bug!)
  • Some mathematical operations return negative zero or not.

这篇关于$var = 500 和 $var = '500' 之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆