问题标签 [perl-data-structures]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
perl - Perl 设计模式素材
可能重复:
我怎样才能学会用 Perl 编写结构良好的程序?
我正在尝试通过实现示例来学习 perl 设计模式。有人可以告知有关此方面的良好在线参考手册或书籍吗?
arrays - 我不明白这个 Perl 语法,有人知道吗?
我从 Perl 插件中得到了这一部分。我不明白它的作用。它是关联数组的数组吗?如果是这样,那么它不应该以@开头吗?任何人都可以对这个问题有所了解吗?
perl - 如何在 Perl 的根文件夹中获取叶子目录的列表
我对 Perl(一般的脚本语言)非常陌生,我想知道如何使用 Perl 来获取 Perl 中所有叶目录的列表。例如,假设我的根目录是 C:
如何获得一堆目录路径作为以下场景的输出:
如您所见,我只想列出所有可能的叶子目录。我不希望 C:\A\ 和 C:\B\ 出现。在自己进行了一些研究之后,我注意到我可能以某种方式能够在 Perl 中使用 File::Find 模块,但我也不是 100% 确定如何继续。
感谢您提供的任何帮助:)
multithreading - How do I process a partial order of tasks concurrently using Perl?
I have a partially ordered set of tasks, where for each task all of the tasks that are strictly before it in the partial order must be executed before it can be executed. I want to execute tasks which are not related (either before or after one other) concurrently to try to minimise the total execution time - but without starting a task before its dependencies are completed.
The tasks will run as (non-perl) child processes.
How should I approach solving a problem like this using Perl? What concurrency control facilities and data structures are available?
perl - 解析 perl 数组
我不熟悉 perl,正在尝试编辑 irssi 翻译脚本。Web 请求的结果返回如下:
如何仅获取已翻译的文本部分,以便
谢谢。
perl - 有没有办法用更好的东西替换 Perl 中的 if-elsif-else?
我想构建一堆 Perl 子程序,它们都有相同的模板if elsif elsif else
,可以根据因子变量做出决定。这是子程序模板的示例:
我想知道 Perl 上是否有一些设计模式可以if else
用更优雅的解决方案替换条件,特别是如果我需要更改某些条件或删除其中一些条件,那么这些解决方案将来易于维护?
perl - perl 使用 coderef 作为子程序的参数
我有以下子程序:
并想以my_sub(\coderef($a,$b))
这种方式调用,即我想提供代码 ref 的参数并在 my_sub 函数上运行它。是否有可能在 perl 中做这样的事情?
arrays - 无法将数组转换为哈希
我有一个数组,其中数组元素的值由制表符分隔。例如:
客户端名称\t 所有者\t 日期\t 端口号。
我需要将其转换为哈希,以便可以将其转储到 MySQL 数据库中。就像是:
我遇到的问题是有重复的客户端名称,但它们存在于不同的端口号上。如果我使用 client_name 作为键将其直接转换为哈希,它将删除重复的客户端名称。MySQL 表基于 {name} 和 {port} 建立索引。
有什么方法可以将其转换为哈希而不会丢失重复的客户端名称?
perl - perl中这个变量的数据结构是什么?
我是 perl 的新手,正在阅读用 perl 编写的代码。一行是这样写的:
我熟悉哈希的外观%samplehash
和访问方式$samplehash{a}="b"
但是上面这行实际上说明了什么是 Map 呢?