perl

Passing one subroutine to another subroutine

≯℡__Kan透↙ 提交于 2021-02-10 19:28:16
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

Passing one subroutine to another subroutine

江枫思渺然 提交于 2021-02-10 19:28:07
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

Passing one subroutine to another subroutine

时光怂恿深爱的人放手 提交于 2021-02-10 19:23:06
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

Passing one subroutine to another subroutine

六月ゝ 毕业季﹏ 提交于 2021-02-10 19:21:14
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

十年后将要消失的五种编程语言

本小妞迷上赌 提交于 2021-02-10 19:01:09
点击上方“ Python进击者 ”,选择“ 星标 ”公众号 超级无敌干货每日18:00推送给你!!! 作者 | Program Ace 译者 | 王坤祥 策划 | 小智 本文作者从自己的观点出发,介绍了未来 20 年内可能消失的 5 个编程语言,并给出了具体的原因。最后对想要学习编程的初学者给出了学习建议。 随着时间的流逝,程序员们发现了更新、更简单的工作方式,新的编程语言如雨后春笋般出现,但只有少数编程语言能成为社区的新宠。这种进步的一个副作用是一些古老的编程语言必然会跟历史一样被人们遗忘。如果一个编程语言无法随着时间的推移提升其价值,那么它的用户群终将会流失,并逐渐淡出人们的视线,或者成为更新一代编程语言的基础。 最近,古老的 COBOL 编程语言上了热搜。在 1960 年代和 1970 年代,它曾经是许多美国银行和政府机构的首选的编程语言,但最终被更加简单有效的编程语言所取代。但是,使用 COBOL 构建的系统仍然存在,当一些政府机构发现他们需要通过更新代码来全面改革失业系统时,才发现业内没有几个开发人员可以熟练使用该编程语言。 沧海桑田,COBOL 早已物是人非。我们当前的许多编程语言也注定会有相似的下场。本文中,我们将分析未来 20 内最终会消失的 5 种编程语言。我知道这可能会伤害到那些正在使用这几个编程语言的程序员的内心

Error ORA-12154 on DBI->connect to Oracle database with Oracle Instant Client in Solaris 10

大兔子大兔子 提交于 2021-02-10 18:42:56
问题 I've been pulling my hair out over this problem for two days now: I'm trying to get a perl script to interface with an Oracle database. I have a new server I'd like to deploy my application on. This script previously worked. Here's what I've done so far: Placed my tnsnames.ora file in instantclient/network/admin: ls -la network/admin/ total 8 drwxrwxrwx 2 m staff 512 Apr 19 09:54 . drwxrwxrwx 3 m staff 512 Mar 28 15:56 .. -rwxrwxrwx 1 m staff 777 Apr 19 09:54 tnsnames.ora My Perl script looks

Problem with backticks in multi-threaded Perl script on Windows

依然范特西╮ 提交于 2021-02-10 15:20:33
问题 I have a trouble with the following very simple and small Perl script on Windows platform. use strict; use warnings; use threads; use threads::shared; my $print_mut : shared; my $run_mut : shared; my $counter : shared; $counter = 30; ############################################################### sub _print($) { lock($print_mut); my $str = shift; my $id = threads->tid(); print "[Thread_$id] $str"; return; } ############################################################### sub _get_number() {

How can I disable constant folding in Perl?

十年热恋 提交于 2021-02-10 14:14:41
问题 Given a command like, perl -MO=Deparse -E'use constant FOO => 42; print FOO()' How can I disable constant folding such that print 42; Shows me print FOO(); Or the like. Ideally, I would like this to be a compiler option that works for all of Perl . You can see this talked about in this thread on the perl mailing list, [perl #97942] [PATCH] Add -DO option to disable optimizations and disable constant folding and the peephole optimizer when used.. I tried -DO and it didn't work. If that option

What to include when using Encode with PAR Packer

有些话、适合烂在心里 提交于 2021-02-10 13:56:30
问题 I've been working with PAR::Packer to create standalone executable files out of Perl scripts. The only difficulty I have with it is figuring out what extra DLLs I have to force it to include via the -l option. I'm now working with a Perl script that requires Encoding with utf16-le. The Encode::find_encoding function works just fine in the script, but it doesn't work after I have packaged it with pp . Here's a tiny script (let's call it encode.pl) to illustrate the problem: use strict; use

Only extract those words from a list that include no repeating letters, using regex

丶灬走出姿态 提交于 2021-02-10 08:41:52
问题 I have a large word list file with one word per line. I would like to filter out the words with repeating alphabets. INPUT: abducts abe abeam abel abele OUTPUT: abducts abe abel I'd like to do this using Regex (grep or perl or python). Is that possible? 回答1: It's much easier to write a regex that matches words that do have repeating letters, and then negate the match: my @input = qw(abducts abe abeam abel abele); my @output = grep { not /(\w).*\1/ } @input; (This code assumes that @input