Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [perl]

Perl is a procedural, high-level, general-purpose, dynamic programming language, known for its native support of regular expressions and string parsing capabilities. Please use this tag for questions about Perl in general. For things related to the new (but related) language "Perl 6", please use the ...

1
vote
2answers
34 views

perl how to extract #define'd number from C header file

I am looking for a Perl snippet to print the number 100, contained in a C header, to the terminal. #ifndef VERSIONS_H #define VERSIONS_H #define __SOFTWARE_REVISION__ 100 #endif I am able to ...
0
votes
0answers
19 views

Large difference in execution times between production and testing environments - why?

I have developed a Perl script that basically reads from a set of tables created by a report function that run during lower workload times of the day, stores the data into hashes, processes those ...
-5
votes
0answers
20 views

replace in a text file the string “NNNNN” by a different random string in each line [on hold]

I have a text file like this: ..... GGCCAAGGTCTGACAACCCTAGGGCTTCAGCTTCCCGATATCCGACGGTAGTGTNNNNNAAAGCCTCAGAAAAAACG GTGGGGCTCTCAAAGTGACTTTGTTAAAACTTCAGCTTCCCGATATCCGACGGTAGTGTNNNNNTGTTTTTGTTCCTCCT ...
0
votes
0answers
15 views

Can't locate DBIx/Class/Schema.pm in @INC (@INC contains

I have a dependecy package where linux cannot locate this package. so I tried to install it but it seems like it does not work. for example, this one https://centos.pkgs.org/7/harbottle-epmel-x86_64/...
0
votes
2answers
42 views

How to move files from a server to the computer using perl

I want to move files from a server that my Windows computer is connected to, to the actual computer. I have tried the code on my mac and it works fine, so I suspect the problem has to do with the fact ...
0
votes
1answer
16 views

perl module Class::HPLOO v0.23 install issue

I am trying to install Class::HPLOO perl module and running into issue. I am using perl version 5.28.0. I desperately need help resolve this issue and I am trying to resolve this since last few days ...
3
votes
4answers
44 views

Using Perl in-line edits, how do you insert a line after the Nth occurence of a string?

Looking for a method to insert a line after the Nth occurence of a given string. The following is close to what I'm looking for, but is line number based, versus based on the Nth occurrence of a ...
0
votes
1answer
31 views

Malformed UTF-8 character when matching Non Breaking Space

I am using utf8 in my perl program and I have got the following code line: $$pstring =~ s/\xA0/ /g; which should clean out non breaking spaces from the string. Under Ubuntu 16.04 and perl v5.22.1 ...
0
votes
0answers
14 views

How to close ideal connections of postgresql 9.2 from RHEL 7.5?

I am new to postgresql and perl. I wanted to debug my perl script which may have connection leakage and giving errors in the logs failed: FATAL: sorry, too many clients already at Some/Directory/...
0
votes
1answer
12 views

Dsmod user address tab

I have the following code: my $mod_order = qx /dsmod user "CN=$user_new,$new_dn" -title "$title" -dept "$department" -company "$company" -s $dc -u $Conn_Args->{logonname} -p $Conn_Args->{pwd} 2&...
4
votes
2answers
57 views

How can set a hard maximum recursion depth in Perl?

Although in some cases I might want to allow deep recursions in my code, I want to be able to disable it in certain cases (like while testing). I know that when using the debugger I can use $DB::deep ...
0
votes
3answers
53 views

Calling one Perl program from another

I have two Perl files and I want to call one file from another with arguments First file a.pl $OUTFILE = "C://programs/perls/$ARGV[0]"; # this should be some out file created inside work like C://...
1
vote
1answer
30 views

Unable to read a cookie from perl when set by a php webpage

I have 2 webpages under the same host. 1 in php and 1 in perl cgi. The php page is setting a cookie "c" under a domain "d.com" and path "/". In perl I am trying to read the value of the cookie "c". ...
-2
votes
0answers
15 views

How to compare different phases and display which “start phases” and “end phases” are completed in .log file in perl? [on hold]

There are different "start phases" and "end phases" in a log file.How can I store all the phases in an array and compare them with the "start phases" and "end phases" completed in current .log file?
0
votes
1answer
42 views

Translating malformed HTML to hierarchical XML

I am currently looking for a way in Perl to write the following output in XML files h1 Is the parent level h2 is the child level of h1 h3 is a child level of h2 (or a subchild of h1) etc. Example ...
-2
votes
1answer
56 views

Writing a file and Reading it in Perl

I'm trying to build a primary key into a new file from an original File which has the following structure (tbl_20180615.txt): 573103150033,0664,54,MSS02VEN*',INT,zxzc,,,,, 573103150033,0665,54,...
0
votes
0answers
25 views

LWP 401 Unauthorized URL Check (certificate checks skipped)

I'm trying to check URL status (200 status code), that require a user name and password (popup authentication window). Using LWP command with Perl (v5.16.3) While trying to run the script, im getting ...
-2
votes
1answer
58 views

Split a Matrix file into multiple files based on column name [on hold]

I have a large tab delimited file with thousands of columns and many thousands of line. It looks like: ID A_1 A_2 A_3 B_1 B_3 B_4 C_2 C_3 C_5 xx 01 02 03 04 05 06 07 08 09 xy 03 05 33 ...
0
votes
3answers
51 views

Is that proper way to use rsync command? [duplicate]

$var = "/nfs/sc/disks/darshils/scripts/"; here $var is a string system 'rsync -av $var/.*pl /scripts/'; system command use for in perl lang I can execute any unix command Is that way is it ...
0
votes
2answers
90 views

Read a file line by line and replace a string, print to out file

Currently i am using following code to do find the string replace the string and print it to the out file with the same name of that in file but in the replaced folder use Tie::File; @files = <*&...
-1
votes
1answer
43 views

How to execute .exe file created on WIndows on other platform using Perl

Is it possible to execute executable file (.exe) created on Windows on other platform such as Solaris using Perl ? Does Perl have any library to .exe file created on other platform ?
-3
votes
0answers
25 views

Perl: overall length and pattern in one single regex [duplicate]

I would like to know if it would be possible to evaluate the following in one single regular expression: 1) the string has to follow a variable pattern (e.g. from 1 to 3 alphabetical characters ...
2
votes
1answer
29 views

Why is no output files written in prinseqlite perl loop?

I am completely new to this type of coding/command lines, so I am sorry if I am asking this question in a wrong way. I want to loop over all files in a directory (I am quality trimming DNA sequencing ...
0
votes
1answer
45 views

Can I suppress the “Perl API version %s of %s does not match %s” error

I copied a Perl module (DBD::Pg) from one system to another to run some quick checks on a Mojolicious project. On the new system, it all works fine when I run it under morbo (the Mojolicious test web ...
-2
votes
0answers
39 views

Adding segments to an HL7 message

I have a file that looks like this: FHS|^~\&|LAWSON|Lawson|ESI|ESI|201808201119||||| MSH|^~\&|LAWSON|Lawson|ESI|ESI|201808201119||MFN^MUP|201808201119000001|P|2.1|000001| ZIT|132^...
-2
votes
1answer
38 views

Extracting time with regex

I am trying to get just the time out of this line 10.11.17.31 - ldjfu [20/Aug/2018:00:00:40 -0600] GET /aghdj/shflf/heartbeat HTTP/1.0 200 650 - F5 Heartbeat EExL34L-CFYSLHwerKajtqP2Z8bf 0.006 ...
0
votes
2answers
68 views

How to dump the data behind a hash reference [on hold]

I am trying to debug some legacy Perl code, and I am using Data::Dumper to help. I have the following variables and I'm not sure how to pass these to Data::Dumper to print their contents $Class = ...
0
votes
1answer
37 views

XML::LibXML changing character entity from hex to decimal

How can I stop Perl XML::LibXML from changing special characters from decimal to hex, like &#xA to &#10? Perl code use XML::LibXML; my $doc = XML::LibXML::Document->new('1.0', 'utf-8'); ...
-5
votes
0answers
33 views

.cgi works on command line but not on website ERROR 500 [duplicate]

I have run two simple Perl CGI programs; both of them work. Now I am running three other programs webadmin.cgi, admin.cgi, and packages.cgi; webadmin.cgi requires the other two. From the command ...
1
vote
1answer
34 views

Excess symbol after reading a file

I'm trying to run a command after reading a file. when I use $hostname in the command I see ssh machine? ps auxw -U myname 2>&1 So I have a superfluous ? there. My host file consists of: ...
2
votes
2answers
58 views

How to use a capture specific strings in a regular expression?

Below is my regular expression: Function1(.*?)(google)((.|\n|\r)*?)LAST\); I want to capture this entire function that includes spaces,newlines etc. I have bunch of functions inside my script but ...
1
vote
2answers
42 views

How to export environment variable set in perl script to batch shell?

I am executing a perl script on windows, using a batch script. I am setting below variable in batch script: SET PATH_VAR=C:\Users\ I am able to access PATH_VAR in perl as below: my $path1 = $ENV{'...
1
vote
1answer
39 views

Get week of year (the first day of week is Sunday) could not return week 53

use strict; use Time::Local; use POSIX qw(strftime); my $date = '12/31/1899'; my ($month, $day, $year) = split '/', $date; my $epoch = timelocal( 0, 0, 0, $day, $month - 1, $year - 1900 ); my $week ...
1
vote
2answers
44 views

Why does my Perl unit test for a CGI program fail all its tests?

i would like to test a little program in perl .cgi this program is at this url: https://perlmaven.com/testing-perl-cgi this program is a general test and he say: "it is enough to show how to test ...
0
votes
2answers
56 views

Perl:Issue passing self

I'm having an issue with a recent code review. I've been advised to change the following function call: storeShmcoreservJobsLogs( $self->{'shmJobDetails'}, $self->{'nhcJobDetails'}, ...
1
vote
1answer
28 views

tkdiff and diff does not work beacause of “\0” [Perl]

I stumbled upon the following piece of code in Perl: my $val = $x->insertEl($data) or die $y->ErrorMessage(); print "\0$val\0"; What does \0 mean in this scenario? This script creates a debug ...
-2
votes
1answer
44 views

How to read multiple ids from URL in cgi

I'm passing thru a URL multiple values for id. and I'm trying to read all of those values and run a mysql query for each of the value. The values came from a select all option on a different page. ...
1
vote
2answers
77 views

The results of my simulation are non-intuitive

A simple question has been bugging me and I don't know how to do the mathematics to prove it, so I wrote a simple Perl program to approximate an answer and I just don't agree with its results. Am I ...
0
votes
1answer
50 views

Perl replace string in file using wildcard

I'm new to Perl and trying to replace a line in a text file using a wildcard. Example file: This is a text file. My working (non-wildcard) example: file=/home/test.user/test.txt perl -pi -e 's/This ...
0
votes
1answer
34 views

CGI error Can't use an array as a reference

My configuration is Debian Stretch I verify my Perl code with the command line perl -wcT admin.cgi I have an error in the code at this line: print &select("$id-2",\@values,\@values,@{$FORMAT{...
2
votes
3answers
88 views

Parsing data from delimited blocks

I have a log file content many blocks /begin CHECK ... /end CHECK like below: /begin CHECK Var_AAA "Description AAA" DATATYPE UBYTE Max_Value 255. ADDRESS 0xFF0011 /end CHECK /begin CHECK Var_BBB ...
-3
votes
0answers
17 views

Generate AutoSys P1 alert [on hold]

I need to set up an AutoSys job which generates a P1 alert when there are up to 60 CSV files in the directory E:\DATA\ OS: Windows—I know that I should use a dir request I use Perl to configure the ...
1
vote
0answers
29 views

How to fix the WSDL file not well-formed (invalid token) issue

I have created WSDL file connect the file with PERL soap method. After the exection i get the below error message "not well-formed (invalid token) at line 1, column 1, byte 1 at /usr/lib/x86_64-...
1
vote
1answer
62 views

Executing perl via cgid on solaris fails in 64 bit, but works in 32 bit

I have a custom build of apache's httpd version 2.2 together with perl version 5.22 on solaris 10. The httpd runs in a chroot environment, and the perl script is executed via httpd's mod_cgid. So far ...
-1
votes
0answers
17 views

How to add component while creating an issue via JIRA REST API using perl

In my perl script, $finalstr value am getting as [{name => 'SIP'},{name => 'Platform'}], however this is not getting substituted in the REST API for the "components" field in Jira. But if i pass the ...
0
votes
0answers
27 views

perl 5.28 compilation error “LNK2001” [on hold]

Trying to compile the perl source and facing the following issue with 32-bit server. Has anyone faced and fixed this issue?. link -dll -def:perldll.def -base:0x28000000 -out:..\perl528.dll @...
1
vote
2answers
53 views

items in array A that are not in array B [duplicate]

What is a quick way to determine items in array A that are not in array B? So far I have the following, but can it be done in one line? for $aname (@anames) { if (not grep { $_ eq $aname } @hrefs)...
2
votes
2answers
61 views

What does this command in Perl do?

An entire shell command can be executed like a function, returning its output in place. This is done by surrounding the command with parentheses and prefixing a dollar sign: u$(perl -e 'print "na";'...
5
votes
3answers
94 views

Perl Program to Print Unicode From Hex Value

I am starting up with Perl and confused on how to render unicode characters given a hex string variable. #!/usr/bin/perl use warnings; foreach my $i (0..10000) { my $hex = sprintf("%X", $i);...
-5
votes
2answers
35 views

If condition based look up not working [on hold]

I want to look up a range, and return group id, and though a simple if based lookup would work. But, it is not working, I am not sure why. Can somebody help please. #!/usr/bin/perl sub get_xid { ...