首页 \ 问答 \ 为什么文件句柄不需要Perl中的sigil?(Why doesn't a filehandle need a sigil in Perl?)

为什么文件句柄不需要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.
  • 根据参数顺序,这个函数的确似乎使用了不同的逻辑。 我觉得有两件事要玩。 首先,看这个例子: echo similar_text('test','wert'); // 1 echo similar_text('wert','test'); // 2 似乎是它正在测试“param2中找到了param1中有多少个不同的字符”,因此如果你交换参数,结果会是不同的。 据报道是一个bug ,没有被任何人确认。 现在,上述对于PHP和javascript实现都是一样的 - paremeter命令有影响,所以说JS代码不 ...
  • 在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 ...
  • 您需要使用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 ...
  • 我刚用一小组测试条目尝试了你的代码,它工作得很好。 也许你的查询结果很奇怪? 这是代码: $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 - ...
  • 为了使索引工作,数组$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 ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)