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 Raku (formerly "Perl 6"), please use the raku tag. For Perl-style regular expressions in other languages, use the regex tag, or, if they are based on the PCRE library, the pcre tag.

perl
Filter by
Sorted by
Tagged with
1 vote
1 answer
56 views

How to uninstall the Oracle DB Client when $ORACLE_HOME has spaces in the path?

I have a bunch of Windows machines that need to have the Oracle Database Client removed and reinstalled on them. The problem I'm having is that whoever installed them used C:\Program Files\Oracle\...
Wes Sayeed's user avatar
1 vote
0 answers
72 views

Inline::Java inside of Perl Threads: unknown java object reference)

I try to run java-code inside of Perl - using Inline::Java Working all very well - but not when I have Theads in place. x.pl use strict; use warnings; use lib "."; use MyP; use Inline Java =...
chris01's user avatar
  • 11.7k
1 vote
1 answer
82 views

Perl SSL_verify_mode warning

Got some code (simple RESTAPI query) migrated from an old Linux machine to a new Linux machine where Perl modules have been installed in an unknown way. Using the following modules : use JSON; use ...
Denis.A's user avatar
  • 191
1 vote
1 answer
34 views

Perl Mason strange behavior - compilation gets error at $m which is not there

I have this piece of code (shortened): my $lins = $dbh->selectall_arrayref("SELECT id, name, popis, pic FROM line", { Slice => {} }) or die 'Query (SELECT from line) failed'; ... my $...
tloudev's user avatar
  • 49
1 vote
1 answer
98 views

Perl and sub-normal floating-point zeros

Playing with the floating-point format in Perl, I noticed some oddity: It seems Perl 5.18.2 (on x86_64 Linux at least) does not handle sub-normal numbers (like -0) correctly (given the IEEE 64-bit ...
U. Windl's user avatar
  • 3,947
-1 votes
0 answers
41 views

Disabling specific Apache::DBI::db debug messages in Apache2 error.log

How can I disable specific error messages in my Apache2 error.log related to SV = IV, REFCNT, FLAGS, and RV, which refer to Apache::DBI::db? Below is an example of the types of messages I'm receiving: ...
Erik's user avatar
  • 1
1 vote
1 answer
62 views

Timeout with HTML::TreeBuilder

I was wondering if there is some elegant way to implement timeout with HTML::TreeBuilder. My current implementation is as follows: use constant WEB_AGENT => 'Mozilla/5.0'; use constant ...
Ωmega's user avatar
  • 43.1k
-1 votes
3 answers
89 views

How to compare floating point numbers in Perl for "equality"

Note that I had set "equality" in double-quotes, so read on about the details: I wrote some code that stores Perl objects in a file and retrieves them from there. I'm using my own JSON-based ...
U. Windl's user avatar
  • 3,947
1 vote
3 answers
67 views

"Cannot run test (h_c: is_deeply($n, $s)) with active children at /usr/lib/perl5/5.18.2/Test/More.pm line 1020"

Trying to convert some code from use Test::more to use Test::Builder I got this problem when trying to use is_deeply (perl 5.18.2): Cannot run test (h_c: is_deeply($n, $s)) with active children at /...
U. Windl's user avatar
  • 3,947
2 votes
0 answers
73 views

Converting int to bytes, with confusion over significant bits and endianness

I am trying to implement a key derivation function from IEEE 802.11 which is described in pseudocode like this: result ← "" iterations ← ⌈Length / Hashlen⌉ do i = 1 to iterations     result ...
miken32's user avatar
  • 42.4k
5 votes
2 answers
117 views

Issue transitioning to EXPORT_OK from EXPORT

According to Perl Critic we should "Export symbols via @EXPORT_OK or %EXPORT_TAGS instead of @EXPORT" Following this advice I am transitioning my module to @EXPORT_OK from @EXPORT, but I am ...
MERM's user avatar
  • 733
0 votes
1 answer
47 views

How to send file using cURL

I have a simple perl cgi script that either displays a webpage to allow selection of a file, or, if a file was submitted, accepts the file and displays content to browser. It works fine via browser. ...
creas443's user avatar
4 votes
3 answers
179 views

Regular expression for zero-width Unicode characters

I’m converting a table to a human-readable form, and I need to treat the content with zero-length Unicode characters “in a distinctive way”. The only way to recognize them seems to be (even with Perl’...
Ilya Zakharevich's user avatar
3 votes
1 answer
75 views

How to make perl number constant to be always a number when serializing to json

Here is the code that is working as I expect: #!/usr/bin/perl use strict; use warnings FATAL => 'all'; use feature qw(say); use constant MY_CONSTANT => 42; use JSON::XS; say encode_json { ...
bessarabov's user avatar
  • 11.5k
2 votes
1 answer
96 views

Perl Navigator extension not working out of the box in vscode

I'm new to Perl and trying to get syntax checking, code navigation etc. to work in VS Code on my Mac. I have installed the PerlNavigator Extension but it doesn't seem to work out of the box as it ...
F. G.'s user avatar
  • 78
6 votes
1 answer
107 views

How do Perl if-statements work under the hood?

How does Perl's interpreter do if-statements? I wanted to try to implement a simple Lazy-Basic-Block-Versioning for if-statements that use ref as a predicate, and maybe subsequently for sub-routines ...
Rawley Fowler's user avatar
-2 votes
3 answers
76 views

I'd like to understand why unlink doesn't work for one specific file [closed]

I have a script that creates some temp files for processing later and when they are not needed anymore I want to delete them. The file that won't unlink is always the very last file that's created ...
Pete G's user avatar
  • 79
-1 votes
2 answers
65 views

Perl or Perl debugger optimizing "empty" `if``s?

While developing some code, I ran some incomplete code where the ìf/else parts still need to be done. However the conditions call routines with a "side-effect", so I was expecting to be able ...
U. Windl's user avatar
  • 3,947
1 vote
2 answers
50 views

Environment variables from .csh script to perl script

I am trying to create some automation work and find a requirement to create a perl script that takes multiple csh scripts to run few testcase. Find below .csh and perl scripts. xyz.csh script #!/bin/...
Sarth Rana's user avatar
0 votes
0 answers
54 views

Perl Excel Writer XLSX merge_range_type won't render properly in Excel

I'm writing a calendar app that merges a span of cells across a row to be formatted with a colored background and rich text string. Everything renders beautifully in LibreOffice Calc but Excel gives a ...
user1742494's user avatar
2 votes
1 answer
49 views

Can a reference to an lvalue subroutine be used as an lvalue?

I'm having trouble using a Perl subroutine reference as an lvalue. Am I doing something wrong here, or is it not possible to do this? I'm using ActiveState Perl 5.20 on Windows. package Warning { ...
FreonPSandoz's user avatar
2 votes
2 answers
86 views

How to embed s/\A{/LB/ in the EXPR of s{...}{EXPR}e?

I've read 'Quote and Quote-like Operators' in man perlop but can't figure out how to use s/.../EXPR/e if EXPR contains code which itself contains a substitution involving both \A and the outer ...
jimav's user avatar
  • 799
1 vote
2 answers
85 views

Getting result rows as array with DBIx::Class?

Is it possible to get a plain arrayrefs as rows of a DBIx::Class search? I can do this my $rs = $db->resultset("SomeTable")->search({}); my $results = $dbh->selectall_arrayref(&...
simone's user avatar
  • 4,953
1 vote
1 answer
61 views

exec a perl command in Tcl with dollar sign

I call a grep/perl command to extract a substring from a file in a tcl script. However I can't find a way to escape $ in perl script. Here is my command: set varA [exec grep ^library $file | perl -pe '...
David Peng's user avatar
1 vote
2 answers
58 views

Mojo::Home where is the spew method?

Is the method silently gone? This produce an error, I have no clue why. #!/usr/bin/env perl use Mojo::Home; my $f = Mojo::Home->new->path('test.txt'); $f->spew('test'); Can't locate object ...
Struppi's user avatar
  • 163
2 votes
6 answers
76 views

Is it possible to make Test::more report the line of an indirect caller (level-n caller)?

I wrote some test framework using Perl's Test::more, specifically using the ok($test_result, $test_description). As some tests "cluster", I wrote a subroutine that performs multiple ok() ...
U. Windl's user avatar
  • 3,947
2 votes
1 answer
76 views

Perl: WWW::Google::CustomSearch: Missing required arguments?

(2024-03-01 update: following question was misleeding. This bug was already reported to the maintainer and I found a workaround. Please see the comments) I'm writting a script to run the Google Custom ...
Chihiro  Fukazawa's user avatar
0 votes
1 answer
112 views

How to connect oracle DB using JDBC URL or connection String in Perl script

I have a jdbc connection string and want to connect db in perl script, but no idea how to do it. my $connstr = 'jdbc:oracle:thin:@ldap://server:port/db_name,cn=OracleContext,dc=world'; my $user = &...
prabjot singh's user avatar
0 votes
2 answers
74 views

How to filter file selection

I have files of the form wrfout_d01_2024-02-08_01_00_00 wrfout_d01_2024-02-08_02_00_00 wrfout_d01_2024-02-08_03_00_00 ... where the last nonzero digit is the day of the month. I want to select only ...
Zilore Mumba's user avatar
  • 1,420
-1 votes
5 answers
135 views

Print lines between 1st match and 2nd match, 2nd match that came after the 1st match in Linux

I have a series of data I want to print the data after one match and next different match which comes after the first match for example, I have AAA AAAD BBB CCC AAA AAADD Want the data between AAAD ...
Keshav Mathur's user avatar
2 votes
1 answer
54 views

Dynamic tar/archive creation in Mojolicious

I have a directory of uploaded files, and I want to the user to download all files as an archive/tar. This is what I have implemented so far: get '/admin/downloadmedia' => sub { my $c = shift; ...
Pradeep's user avatar
  • 3,123
3 votes
1 answer
48 views

HiPi (Raspberry Pi library) fails with undef subroutine HiPi::GPIO::xs_gpio_*

Whatever function to control a GPIO pin with module HiPi / HiPi::GPIO I try - it always fails with Undefined subroutine &HiPi::GPIO::xs_gpio_write called at /usr/local/lib/aarch64-linux-gnu/perl/5....
Ekki's user avatar
  • 74
2 votes
1 answer
84 views

What is @ :: ARGS in Perl?

I was reading some code and found (code accepting filename and command line parameters) @ :: ARGS = ($0,@ARGV); But, I am unable to understand the first part of the expression. What exactly it is ...
SwapnilM's user avatar
  • 187
0 votes
1 answer
66 views

Automatically unlock tables upon control C

I have observed that if I hit control C on a running perl DBI script that the next run of the same script will hang. I have confirmed with ps that the script is not running after I click control C. I ...
Be Kind To New Users's user avatar
1 vote
1 answer
52 views

"Prototype mismatch" warning with Test2::Mock

Running the following code: #!/usr/bin/env perl use 5.038; use Test2::Mock; use Time::HiRes; my($mock) = Test2::Mock->new( class => 'Time::HiRes', override => [ ...
Joe Casadonte's user avatar
4 votes
1 answer
100 views

Remove stop codon from file and replace it with NNN

I want to write Perl code which checks for stop codon and replaces it with NNN. I have written code as follows: #!/usr/bin/perl use strict; use warnings; # Check if the file name is provided as an ...
somilsharma's user avatar
2 votes
1 answer
88 views

perl script to check 2 byte unicode is not working

My perl script is not finding the unicode character in the name below. Helen Mon‘ea When I viewed the above name in UTF-8, it shows as x91 #!/usr/bin/perl use warnings; @ARGV >= 2 or die "...
Vamperl's user avatar
  • 21
2 votes
1 answer
85 views

Perl subroutine in package to modify hash outside of it

to summarize: i have a main script with a hash in it this main script calls a package, where i have a subroutine from where i want to modify the contents of this global hash (to add elements to it) ...
olivierg's user avatar
  • 760
3 votes
3 answers
140 views

YAML ignores empty array entries if they are at the end of the array

I have a simple code that reads a YAML file and dumps it back out into CSV: my @data = YAML::LoadFile(${$testplan_path}); foreach (@{$data[0]}) { print "HERE\n"; print Dumper ...
Harry Whitnear's user avatar
2 votes
1 answer
88 views

Problems with datatable using jQuery and perl

I need help with my Datatable data processing Am having a problem with my Script below of Server Side Processing (Datatable) its not displaying the data from backend script The problem it just hangs ...
tom lee's user avatar
  • 21
2 votes
0 answers
104 views

How does the code to drop privileges that is shown in perlsec actually work?

In perlsec, there is the following code that drops privileges (the line numbers have been added by me): 1 my @temp = ($EUID, $EGID); 2 my $orig_uid = $UID; 3 my $orig_gid = $GID; 4 $EUID = ...
Binarus's user avatar
  • 4,115
4 votes
3 answers
175 views

What is the best way to ignore elements in a list assignment?

I am using a list assignment to assign tab-separated values to different variables, like so: perl -E '(my $first, my $second, my $third) = split(/\t/, qq[a\tb\tc]); say $first; say $second; say $third;...
Wes's user avatar
  • 495
-2 votes
1 answer
205 views

cpan : command not found on Redhat 9

I want to compile Qt5 on RedHat 9, and when I run the ./configure command, I get the following message: Can't locate English.pm in @INC (you may need to install the English module) (@INC contains: /...
mnekkach's user avatar
  • 195
3 votes
2 answers
85 views

Strawberry perl - input file streaming issue

I have some perl scripts that stream input file and parse it in live. It worked well until Strawberry perl version 5.32.1.1, but it does not work anymore with 5.38.0.1. I wrote a basic example showing ...
Jean-Marc's user avatar
  • 183
3 votes
2 answers
90 views

Remove quotes from hash key with expression

I have: $rejected->{join ',', @needed}++ unless @filtered; but the perlcritic complains with title=Hash key with quotes - severity 5::[HashKeyQuotes] Avoid useless quotes Obviously I can lower ...
b10n1k's user avatar
  • 605
0 votes
1 answer
67 views

Replace multi line text with another multi line text using the perl command

Previously I was trying to do it with sed but found that perl is better suited for multi line find and replace. Simple strings work fine but when it comes to strings with special characters it is not ...
Labeeb's user avatar
  • 31
2 votes
1 answer
80 views

Perl DBI::SQLite: How to Dump a table with column names?

Similar to How to get a list of column names on Sqlite3 database?, but still different: For debugging purposes I wrote a closure that dumps an SQLite3 table. The output is not very pretty, but it ...
U. Windl's user avatar
  • 3,947
2 votes
1 answer
101 views

How to use alarm perl function to set a timeout on a Python command running on Windows?

In a Perl script, I would like to run a Python command and kill it if it is not over after 5 seconds. Here is the code I use: use strict; use warnings FATAL => 'all'; use autodie qw(open); my $...
Pierre's user avatar
  • 2,042
-1 votes
1 answer
114 views

How do I generate a QR code with a picture in Perl?

I want to generate a QR code with a picture in the center of QR code. Is this possible to generate QR code with a picture inside the QR code with Perl? I tried different libraries, but still can't ...
Maksym's user avatar
  • 75
1 vote
2 answers
127 views

Issues with pattern searching with `grep` and then replacing in Mac OS

There are many similar posts available on SO. However, the answers given there do not work for me. I am using Mac OS Monterey with version 12.6.5. I am searching all the files in a directory that ...
hbaromega's user avatar
  • 2,342