为什么文件句柄不需要Perl中的sigil?(Why doesn't a filehandle need a sigil in Perl?)
在Perl中,filehandle是一种数据类型,我期望这种类型的变量具有某种类型的sigil前缀。 但是,下面的代码(第二次打开)表明情况并非如此
open my $fileHandle, '>', "out.txt"; open FH, '>', "out2.txt";
我发现第二种形式令人困惑/不一致。 允许第二种形式的原因是什么?
In Perl, filehandle is a data type, and I'd expect a variable of such type has some kind of sigil prefix. However, the following code (2nd open) shows that it's not the case
open my $fileHandle, '>', "out.txt"; open FH, '>', "out2.txt";
I found the 2nd form confusing/inconsistent. What is the reason for allowing the 2nd form?
原文:https://stackoverflow.com/questions/40831471
更新时间:2020-04-25 16:04
最满意答案
你应该开始看看:
ext/standard/string.c line: 2999
这是为PHP 5.4.10。
您可以使用以下方法找到它:
grep -r 'similar_text' PHP_SOURCE_FOLDER
You should start to have a look at:
ext/standard/string.c line: 2999
This is for php 5.4.10.
You can find this out for yourself using:
grep -r 'similar_text' PHP_SOURCE_FOLDER
相关问答
更多-
PHP开发人员承诺至少对于微版本更新(xyz中的z)具有向后兼容性,因此应该没有问题。 The PHP developers promise backward-compatibility at least for micro-version updates (The z in x.y.z), thus there should be no problem.
-
similar_text如何工作?(How does similar_text work?)[2022-03-06]
根据参数顺序,这个函数的确似乎使用了不同的逻辑。 我觉得有两件事要玩。 首先,看这个例子: echo similar_text('test','wert'); // 1 echo similar_text('wert','test'); // 2 似乎是它正在测试“param2中找到了param1中有多少个不同的字符”,因此如果你交换参数,结果会是不同的。 据报道是一个bug ,没有被任何人确认。 现在,上述对于PHP和javascript实现都是一样的 - paremeter命令有影响,所以说JS代码不 ... -
PHP正在显示我的源代码?(PHP is displaying my source code?)[2023-05-22]
在5.3 short_open_tag 默认情况下禁用。 所以,如果你使用 ?> 代替 它可能导致将来出现问题(前提是你只需在php.ini中启用该标志)。 据我所知,他们仍然在争论从6岁开始。 In 5.3 short_open_tag is disabled by default. So if you use ?> instead of it can cause issues in the future (provided you ju ... -
使用php从数据库中选择值,其中条件值类似于输入(Select value from database with php where condition value is similar to input)[2023-06-24]
您需要使用LIKE关键字 SELECT value FROM table WHERE condition like %x% 编辑: 好像你是levenshtein算法。 看看这里和这里 。 StackOverflow Thread You need make use of the LIKE keyword SELECT value FROM table WHERE condition like %x% EDIT : Seems like you are for levenshtein algorithm ... -
这是一个提示:仔细观察JavaScript版本的第28行 - 特别是该行的最后一个字符。 这就是你的实现不同的地方。 (对于每对索引,您也不会将l重置为零,但这不是最重要的问题。) 顺便说一下,这是一个无变量的Scala版本: def similarText(x: String, y: String): Int = { val indices = for { (s, p) <- x.tails.zipWithIndex (t, q) <- y.tails.zipWithIndex ...
-
将您的添加更改为行 function addTo($line){ return strtolower(trim($line)); } 并将您的输入更改为 $input = strtolower(trim($_GET['checkSpelling'])); 文件命令有一个令人讨厌的习惯,就是留下尾随的换行符,所以你可能根本不匹配...修剪应该处理它。 其他变化只是为了使它不区分大小写。 Change your add to line to function addTo($line){ re ...
-
main/php_version.h文件包含您要查找的信息: 例如( https://github.com/php/php-src/blob/master/main/php_version.h ): /* automatically generated by configure */ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 5 #define ...
-
类似的文字php mysql(Similar Text php mysql)[2022-03-10]
我刚用一小组测试条目尝试了你的代码,它工作得很好。 也许你的查询结果很奇怪? 这是代码: $my_word = $_REQUEST['value']; $bestMatch = array('word' => $my_word, 'match' => 2); $result = array("exam", "clinicals", "templates", "reschedule", "crafting", "php", "answer"); $storeArray = Array(); foreach ( ... -
你应该开始看看: ext/standard/string.c line: 2999 这是为PHP 5.4.10。 您可以使用以下方法找到它: grep -r 'similar_text' PHP_SOURCE_FOLDER You should start to have a look at: ext/standard/string.c line: 2999 This is for php 5.4.10. You can find this out for yourself using: grep - ...
-
PHP中的类似文本(similar text in PHP)[2021-07-06]
为了使索引工作,数组$arr必须具有唯一值: $arr = array("foo", "bar", "hallo", "world", "fooo", "bar1", "hall_o", "wor1ld", "bard", "hzallo", "w44orld"); $dexed = array(); foreach ($arr as $key => $value){ $dexed[$key]['val'] = $value; $dexed[$key]['key'] = $key; } $o ...